![](/img/trans.png)
[英]How to serialize/model inside model json data from Firestore on Flutter
[英]How to upload a custom data model in firestore flutter
我正在使用 firestore 執行某些任務,並且我有一個自定義的 model 產品,我想將該數據推送到 firestore 中的特定 model 但沒有成功
將您的 model 轉換為 map 並上傳 map。 您將無法將自定義對象上傳到 Firestore。 您可以使用類似這樣的方法將 model 轉換為 map,其中foo和bar是您的自定義 object 的字段:
Map<String, dynamic> getMap() {
return {
'foo': foo,
'bar': bar
};
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.