'How to show an AlertDialog triggert by a Firebase Push Notification with go_router?
I have to register a Firebase listener once, like e.g.
void registerListener() {
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
if (message.notification != null) {
showDialog(
context: ???,
builder: ((BuildContext context) {
return _PushAlertDialog(message.notification!.title!, message.notification!.body!);
}));
}
});
}
I don't know when this method is called, so how can I get the current context and do a context.pop() to close the dialog.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
