The latest Cloud Messaging cannot be used
k-y-1202 opened this issue · 1 comments
k-y-1202 commented
I used firebase_messaging: ^11.2.6 .
The example uses 7.0.0, but the usage of FirebaseMessaging.onBackgroundMessage is very different and cannot be implemented.
In particular, the type of RemoteMessage has changed, and the payload cannot be obtained.
Can anyone tell me?
efraespada commented
You can use this for work with the payload:
extension RemoteMessageExt on RemoteMessage {
Map<String, dynamic> getContent() {
return jsonDecode(data['content']);
}
Map<String, dynamic> payload() {
return getContent()['payload'];
}
}
It is what I currently use with the latest version of FCM.