【发布时间】:2021-09-11 11:48:31
【问题描述】:
RemoteMessage 确实有一个名为 notification 的字段。
但是当我们说:message.notification?.title 是什么意思?
? 表示该字段可以为空,但是当我们说?.title 时,是否意味着notification 中有一个title 字段我们正在尝试访问?
https://blog.logrocket.com/flutter-push-notifications-with-firebase-cloud-messaging/
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
// Parse the message received
PushNotification notification = PushNotification(
title: message.notification?.title,
body: message.notification?.body,
);
}
【问题讨论】:
标签: firebase flutter firebase-cloud-messaging