I have an app in which I am using FCM (Firebase Cloud Messaging).
As given in the README, I've managed to get it all working and the event handlers for onResume
, onMessage
, onLaunch
are all firing properly.
The onBackgroundMessage
which I think is supposed to run whenever the notifications appear while the app is inactive, needs a top-level dart function.
I need this function to render a particular widget, say, IncomingCall
. But this being a top-level function, the best I could think of, is to invoke the main()
:
Future<dynamic> myBackgroundMessageHandler(Map<String, dynamic> message) {
main();
}
which then calls runApp(IncomingCall())
but even this is not working.
So how does one render a widget in Dart when the app is inactive?