Skip to content

Conversation

@NestorBurma1
Copy link

  1. Replace builder ExtendedNavigator with AutoRouterDelegate and routeInformationParser in app_widget.dart.
  2. Deleted generateNavigationHelperExtension in router.dart.
  3. Replaced MaterialRoute with AutoRoute in router.dart.
  4. Replaced ExtendedNavigator.of(context).replace with context.router.replace in splash_page.dart.
  5. Update auto_route version in pubspec.yaml.

1. Deleted line generateNavigationHelperExtension: true.
2. Renamed MaterialRoute to AutoRoute.
ExtendedNavigator replaced with AutoRouterDelegate.
Replaced 
ExtendedNavigator.of(context).replace(Routes.notesOverviewPage), 
with
  context.router.replace(NotesOverviewPage(),),
and 
  ExtendedNavigator.of(context).replace(Routes.signInPage),
 with
  context.router.replace(SignInPageRoute(),),
New version 2.3.0
class AppWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
final _appRouter = app_router.Router();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The router should be initialized outside the build(), otherwise, on hot restart it's gonna return an empty screen

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes definitely! Thanks for pointing that out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants