Deprecated
We use auto_route as our routing system as it allow us to:
Currently, We use Flutter MVVM Architecture VScode extension to generate view. To create a view:
Flutter Architecture: Create Views
lib/views/your_view_name/
that contain:Add your page in lib/core/routes/app_router.dart as following:
@MaterialAutoRouter(
routes: <AutoRoute>[
...
AutoRoute(
path: 'books',
page: BooksView,
meta: {
'title': 'Books',
},
),
]
)
From your console, generate them with build_runner:
fvm flutter pub run build_runner build --delete-conflicting-outputs
AutoRouter.of(context)
context.router
router.push(const BooksRoute())
router.pushNamed('/books')
For complex navigator, read more here: