質問編集履歴

1

補足情報

2020/05/07 13:55

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -60,6 +60,28 @@
60
60
 
61
61
 
62
62
 
63
+ ```
64
+
65
+ <pubspec.yaml>
66
+
67
+
68
+
69
+ dependencies:
70
+
71
+ cloud_firestore: ^0.13.0+1
72
+
73
+ json_annotation: ^3.0.1
74
+
75
+
76
+
77
+ dev_dependencies:
78
+
79
+ json_serializable: ^3.2.5
80
+
81
+ ```
82
+
83
+
84
+
63
85
  ```model
64
86
 
65
87
  import 'package:cloud_firestore/cloud_firestore.dart';
@@ -173,3 +195,25 @@
173
195
  flutter: {docRef: Instance of 'DocumentReference'}
174
196
 
175
197
  ```
198
+
199
+
200
+
201
+ #### 試したこと
202
+
203
+
204
+
205
+ - [こちら](https://stackoverflow.com/questions/57514264/how-to-deserialize-firestore-document-with-its-id-using-json-serializable-in-flu)を参考に、これのDocumentReference, String バージョンを行おうとして`toJson`部分のコードが書けず失敗
206
+
207
+ - 上記のコードのmodel内の`final DocumentReference` や `as DocumentReference` 部分を `~ String` として行ったが、ビルド失敗(`_CastError`が出て自動でのシリアライズ失敗)
208
+
209
+
210
+
211
+
212
+
213
+ **環境**
214
+
215
+ macOS Catalina 10.15.4
216
+
217
+ VSCode 1.40.1
218
+
219
+ Flutter Channel beta, v1.17.0