I was trying to use the firebase cloud assessing and in the process, I want to just show a popup dialogue to the user on the arrival of the push notification. But to show the dialogue we need thee context object as one of the arguments of showDialog
is BuildContext
.
I tried many approaches but that didn't work. As of now, my code looks likes this:
_firebaseMessaging.configure(
onMessage: (Map<String, dynamic> message) {
print('onMessage: $message');
return;
},
onBackgroundMessage: myBackgroundMessageHandler,
onResume: (Map<String, dynamic> message) {
print('onResume: $message');
return;
},
onLaunch: (Map<String, dynamic> message) {
print('onLaunch: $message');
Text('onLaunch: $message'),
);
return;
});
Note: This code is written in a separate class, and I am trying to achieve it without any 3rd part library.