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

Error add route #77

Closed
DuhAlonso opened this issue Mar 19, 2020 · 1 comment
Closed

Error add route #77

DuhAlonso opened this issue Mar 19, 2020 · 1 comment

Comments

@DuhAlonso
Copy link

Error when calling the route using Modular.to.pushNamed

My code

Works well
Navigator.pushNamed(context, '/datail/${homeController.text}');

Does not work
Modular.to.pushNamed('/datail/${homeController.text}');

App Module

@override List<Router> get routers => [ Router('/', child: (_, args) => HomePage()), Router('/datail/:text', child: (_, args) => DatailPage( text: args.params['text'], )), ];

Error

Add Modular.navigatorKey in your MaterialApp;
return MaterialApp(
navigatorKey: Modular.navigatorKey,
...
.
'package:flutter_modular/src/modular_base.dart':
Failed assertion: line 94 pos 9: '_navigatorKey != null'

@DuhAlonso
Copy link
Author

DuhAlonso commented Mar 19, 2020

Only navigationKey was missing 🤦🏽.

Add navigationKey in AppWidget

navigatorKey: Modular.navigatorKey,

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

No branches or pull requests

1 participant