I have implemented a notification in the backgound with firebase messaging. But, the problem is this; how can I return the data from the function myBackgroundMessageHandler to FirebaseNotification?
Future<dynamic> myBackgroundMessageHandler(Map<String, dynamic> message) {
return Future<void>.value();
}
class FirebaseNotifications {
FirebaseMessaging _firebaseMessaging;
FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin;
void setUpFirebase() {
_firebaseMessaging = FirebaseMessaging();
}
void fcmListeners() {
_firebaseMessaging.configure(
onMessage: (Map<String, dynamic> message) async {
print("OnMessage");
processNotification(message);
return;
},
onBackgroundMessage: myBackgroundMessageHandler,
onLaunch: (Map<String, dynamic> message) async {
print("onLaunch");
processNotification(message);
return;
},
onResume: (Map<String, dynamic> message) async {
print("onResume");
processNotification(message);
return;
},
);
}
processNotification(message) {}
}