onMessage run multiple async task on iOS

Issue

I want to make an async task in onMessage of Firebase messaging method here.

What I want exactly: I want to launch Facebook app on specific page when a notification come from Firebase when I click on the notification body.

I mean that box that appear on top of screen it brings me Facebook application please if anyone faced this and successfully made it do not hesitate to help me with any information.

@override

Future onMessage(RemoteMessage message) async {

Future.delayed(const Duration(milliseconds: 100), () { launchFbPage();

  printLog('[app.dart] onResume Firebase Push notification: $message');

   saveMessage(message.data);

});
}

and why the print doesn’t work with iOS meanwhile i receive the notification on my iPhone

Solution

So someone had helped me thanks belongs to him.
i had to use this :

 @override

Future onMessage(RemoteMessage message) async {

await Future.delayed(const Duration(milliseconds: 100), () { launchFbPage();

  printLog('[app.dart] onResume Firebase Push notification: $message');

   saveMessage(message.data);

});
}

i had just need to await the Future.delayed

Answered By – Anoir

Answer Checked By – Dawn Plyler (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *