FirebaseMessaging.onBackgroundMessage不起作用。我遵循了官方文档。我使用的版本:firebase_messaging: ^14.2.1
@pragma('vm:entry-point')
Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
print("Handling a background message: ${message.messageId}");
}
void main() async {
await Firebase.initializeApp()
FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
}
Run Code Online (Sandbox Code Playgroud)
这是我通过云函数发送 fcn 的方式:
admin.messaging().sendMulticast({
tokens: [user.fcmToken!],
apns: {
payload: {
aps: {
"mutable-content": 1,
"content-available": 1,
},
},
},
notification: {
body: body,
title: title,
},
data: {
hello: "world?!",
},
});
Run Code Online (Sandbox Code Playgroud)
我可以看到推送通知在我的设备上弹出,但FirebaseMessaging.onBackgroundMessage没有被调用。有什么想法可能是问题出在哪里吗?
如何读取 firestore 中的子集合?
db.collection('users')
.doc('5mmwJba8FVMrdHGOPBYraOQzDe22')
.collection('restaurants').get().then(function(doc) {
if (doc.exists) {
console.log("Document data:", doc.data());
} else {
console.log("No such document!");
}
}).catch(function(error) {
console.log("Error getting document:", error);
});
Run Code Online (Sandbox Code Playgroud)
路径是:/users/5mmwJba8FVMrdHGOPBYraOQzDe22/restaurants/qZg6gkOvYHOPXHDJAqBF
我想按索引过滤对象数组。
<ul>
<li v-for="(list,index) in lists" v-bind:key="index"
@dblclick="deleteNote(index)">
{{list.note}
</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
列表中充满了以下对象imp
var lists = [];
var imp = {
note: "bla",
hinweis: "blub",
showNotiz: false
};
deleteNote(i) {
let arr = this.lists.filter(item =>
item.note !== this.lists[i]
);
this.lists = arr;
}
Run Code Online (Sandbox Code Playgroud) 有人有使用 GetX 路线管理中的英雄动画的经验吗?我按照https://docs.flutter.dev/development/ui/animations/hero-animations中的说明进行操作,并用于Get.toNamed()在我的路线之间导航,但它不起作用。