Milad-Akarie / auto_route_library

Flutter route generator
MIT License
1.56k stars 394 forks source link

Including Micro/External Packages #1804

Open AliAltiyev opened 9 months ago

AliAltiyev commented 9 months ago

The editor could not be opened because the file was not found. The following assertion was thrown building AutoTabsScaffold: 'package:auto_route/src/router/controller/root_stack_router.dart': Failed assertion: line 168 pos 12: 'builder != null': is not true.

The relevant error-causing widget was: AutoTabsScaffold AutoTabsScaffold:file:///C:/Users/alidr/Desktop/flutter_projects/medix/medix/features/dashboard/lib/ui/page/dashboard.dart:11:12

Here is code:

_import 'package:dashboard/dashboard.dart';

@RoutePage() class DashboardPage extends StatelessWidget { const DashboardPage({ super.key, });

@override Widget build(BuildContext context) { return AutoTabsScaffold( routes: const [ MainRouteRoute(), MediatationRoute(), SoundRoute(), ], bottomNavigationBuilder: (, TabsRouter tabsRouter) { return BottomNavigationBar( currentIndex: tabsRouter.activeIndex, onTap: tabsRouter.setActiveIndex, items: const [ BottomNavigationBarItem(label: 'Users', icon: Icon(Icons.abc)), BottomNavigationBarItem(label: 'Posts', icon: Icon(Icons.abc)), BottomNavigationBarItem(label: 'Settings', icon: Icon(Icons.abc)), ], ); }, ); } } My app_router.dart file:

_### _import 'package:navigation/navigation.dart';

export 'package:dashboard/module.dart'; export 'package:main/module.dart';

part 'app_router.gr.dart';

@AutoRouterConfig( replaceInRouteName: 'Screen,Route', modules: [ DashboardPackageModule, MainPackageModule, MeditationPackageModule, SoundPackageModule, ], )

/// The AppRouter class is a router configuration class that defines the routes for the application. /// It extends the _$AppRouter class, which is generated by the auto_route package. class AppRouter extends _$AppRouter { /// Returns a list of AutoRoute objects representing the defined routes in the application. @override List get routes => [ AutoRoute( initial: true, path: '/', page: DashboardRoute.page, children: [ AutoRoute( page: MainRouteRoute.page, path: 'main', ), AutoRoute( page: MediatationRoute.page, path: 'meditation', ), AutoRoute( page: SoundRoute.page, path: 'sound', ), ], ), ]; }__

ilknurimamhaliloglu commented 7 months ago

@Milad-Akarie @AliAltiyev I have the same issue. Did you solve this issue?

anasboyka commented 6 months ago

anyone solve this issue?

sajidshaikh20 commented 1 month ago

@RoutePage() class DashboardPage extends AutoRouter { const DashboardPage({ super.key, });

Please extends AutoRouter. Now its will work Proper