Try creating the file referenced by the URI, or try using a URI for a file that does exist.

Custom Code

I've seen several post about this error. No one fixed it. Please help! Thank you!

Can't import my file, I tried multiples way to write it but does not work.

Target of URI doesn't exist: '/lib/others/dashboard/dashboard_widget.dart'. Try creating the file referenced by the URI, or try using a URI for a file that does exist.

Target of URI doesn't exist: '/lib/others/well_mate_chatbot/well_mate_chatbot_widget.dart'. Try creating the file referenced by the URI, or try using a URI for a file that does exist.

// Automatic FlutterFlow imports
import '/backend/schema/structs/index.dart';
import '/backend/schema/enums/enums.dart';
import '/backend/supabase/supabase.dart';
import '/actions/actions.dart' as action_blocks;
import '/flutter_flow/flutter_flow_theme.dart';
import '/flutter_flow/flutter_flow_util.dart';
import '/custom_code/widgets/index.dart'; // Imports other custom widgets
import '/custom_code/actions/index.dart'; // Imports custom actions
import '/flutter_flow/custom_functions.dart'; // Imports custom functions
import 'package:flutter/material.dart';
// Begin custom widget code
// DO NOT REMOVE OR MODIFY THE CODE ABOVE!

import '/lib/others/dashboard/dashboard_widget.dart' show DashboardWidget;
import '/lib/others/well_mate_chatbot/well_mate_chatbot_widget.dart'
    show WellMateChatbotWidget;

class BottomNavBar extends StatefulWidget {
  const BottomNavBar({
    super.key,
    this.width,
    this.height,
    this.initialPage,
    this.page,
  });

  final double? width;
  final double? height;
  final String? initialPage;
  final Widget? page;

  @override
  State<BottomNavBar> createState() => _BottomNavBarState();
}

class _BottomNavBarState extends State<BottomNavBar> {
  String _currentPageName = 'dashboard';
  late Widget? _currentPage;

  @override
  void initState() {
    super.initState();
    _currentPageName = widget.initialPage ?? _currentPageName;
    _currentPage = widget.page;
  }

  @override
  Widget build(BuildContext context) {
    final tabs = {
      'dashboard': DashboardWidget(),
      'wellMateChatbot': WellMateChatbotWidget(),
    };
    final currentIndex = tabs.keys.toList().indexOf(_currentPageName);

    return Container(
      width: widget.width,
      height: widget.height,
      child: Scaffold(
        body: _currentPage ?? tabs[_currentPageName],
        bottomNavigationBar: BottomNavigationBar(
          currentIndex: currentIndex,
          onTap: (i) => setState(() {
            _currentPage = null;
            _currentPageName = tabs.keys.toList()[i];
          }),
          backgroundColor: FlutterFlowTheme.of(context).secondaryBackground,
          selectedItemColor: FlutterFlowTheme.of(context).secondary,
          unselectedItemColor: FlutterFlowTheme.of(context).alternate,
          showSelectedLabels: true,
          showUnselectedLabels: false,
          type: BottomNavigationBarType.fixed,
          items: <BottomNavigationBarItem>[
            BottomNavigationBarItem(
              icon: Icon(
                Icons.calendar_month,
                size: 26.0,
              ),
              label: 'Dashboard',
              tooltip: '',
            ),
            BottomNavigationBarItem(
              icon: Icon(
                Icons.wechat,
                size: 26.0,
              ),
              label: 'WellMate',
              tooltip: '',
            ),
          ],
        ),
      ),
    );
  }
}

What have you tried so far?

Tried to write it different ways, checked on forums for 1 hour...

Did you check FlutterFlow's Documentation for this topic?
No
3
1 reply