Is it possible to navigate to specific MaterialPageRoute in app from notification click? I have notifications configured in the main screen:
void _configureNotifications() {
final FirebaseMessaging _firebaseMessaging = FirebaseMessaging();
_firebaseMessaging.requestNotificationPermissions();
_firebaseMessaging.configure(
onMessage: (Map<String, dynamic> message) {
_goToDeeplyNestedView();
},
onLaunch: (Map<String, dynamic> message) {
_goToDeeplyNestedView();
},
onResume: (Map<String, dynamic> message) {
_goToDeeplyNestedView();
},
);
}
_goToDeeplyNestedView() {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => DeeplyNestedView()));
}
The problem is, that when i configure it like this, it woks only from Widget where i configured notifications (I guess it's because of using 'context' in Navigator.push(). Is there some way to access to MaterialPageRoute from anywhere in the app without using any context?
Thank you in advance for your answers.