onSelectNotification when good when app open
Future<void> onSelectNotification(String payload) async {
Category category = Category();
category.id = notification.idNew;
category.email = notification.mainphoto;
category.since = notification.since;
category.name = notification.title;
await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => FourthRoute(
category: category,
)));
}
when open and click at notification it's go to FourthRoute
but when closed it's just open app Navigator not working
problem at ios and android
i was think to use SharedPreferences inside onSelectNotification to save key and check it later
but i read dart not working when app closed
the Navigator has to be wrapped as child in MaterialApp widget, otherwise, you have to use navKey to refer you materialApp.
1. final navKey = new GlobalKey<NavigatorState>();
2. MaterialAPP(title: 'title', ..., navigatorKey: navKey)
3. And then use the key to route to your widget,
navKey.currentState.push(MaterialPageRoute(builder: (context) => NewRoute()));