在 vs code 中打开 flutter 项目时突然收到此通知:Do you want to exclude the Visual Studio Code Java project settings files (.classpath,.project..settings,.factorypath) from the file explorer? (选项:全局排除、在工作区中排除、从不)
我暂时选择了从不,但我想知道它到底意味着什么?
我正在寻找一种使用 Flutter (基本上是彩信)以编程方式发送短信中的文本+图像的方法。希望有人能在这里帮助我。
我尝试使用以下功能(node.js v8):
exports.sendComNotification = functions.firestore
.document('Comunicados/{comID}')
.onUpdate((snap, context) => {
console.log('Com triggered');
const newValue = snap.after.data();
const msg = newValue.title;
var message = {
notification: {
title: 'Comunicado da Diretoria!',
body: msg,
badge: '1',
sound: 'default',
click_action: 'FLUTTER_NOTIFICATION_CLICK',
},
topic: "Comunicados"
};
return admin.messaging().send(message)
.then((response) => {
console.log('Successfully sent message:', response);
return
})
.catch((error) => {
console.log('Error sending message:', error);
return
});
});Run Code Online (Sandbox Code Playgroud)
但这会在 fucntions 日志中出现以下错误:
Error sending message: {
Error: Invalid JSON payload received.Unknown name "badge"
at 'message.notification': Cannot …Run Code Online (Sandbox Code Playgroud)google-cloud-functions firebase-cloud-messaging firebase-admin
我正在尝试填充 RxList(GetX Flutter 包),以便我可以在 Listview.builder 中显示实时数据。我尝试在我的 Getx 控制器中使用以下代码:
final videos = List < Video > ().obs;
@override
void onReady() async {
videos.bindStream(loadVideos());
super.onInit();
}
Stream <List<Video>> lista() {
Stream <QuerySnapshot> stream =
Firestore.instance.collection('videos').snapshots();
return stream.map((qShot) => qShot.documents
.map((doc) => Video(
title: doc.data['title'],
url: doc.data['url'],
datum: doc.data['datum']))
.toList());
}
loadVideos() async {
await
for (List < Video > tasks in lista()) {
videos.addAll(tasks);
}
}Run Code Online (Sandbox Code Playgroud)
但我收到以下异常:
'Future' 不是 'Stream<Iterable>' 类型的子类型