Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor AutoRoute according to new implementatiaon #31

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

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
@@ -10,17 +10,19 @@ import 'package:notes_firebase_ddd_course/presentation/sign_in/sign_in_page.dart
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