4

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?

Amit Joki
  • 58,320
  • 7
  • 77
  • 95
  • Did you try to change the local variable and redirect the user to a particular widget base on it? – dubace Nov 04 '19 at 15:01

0 Answers0