Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter firestore中的物体是否有颤振转换方法?_Flutter_Dart_Google Cloud Firestore - Fatal编程技术网

Flutter firestore中的物体是否有颤振转换方法?

Flutter firestore中的物体是否有颤振转换方法?,flutter,dart,google-cloud-firestore,Flutter,Dart,Google Cloud Firestore,我试图找到一种方法来转换我的自定义对象,以便将其发送到firestore。 我试图查看Firestore的文档,但没有发现任何与Flatter有关的内容。 是否有方法转换对象并将其发送到firestore 正如Doug Stevenson在中所说,您可以在firestore文档中存储原始数据。对于特定的颤振,必须从对象创建一个Blob。看见要转换为Blob构造函数采用的Uint8List,请参阅将Dart对象转换为JSON字符串并将此字符串转换为字节数组。这似乎不是一个很好的方法,但我个人不知道

我试图找到一种方法来转换我的自定义对象,以便将其发送到firestore。 我试图查看Firestore的文档,但没有发现任何与Flatter有关的内容。 是否有方法转换对象并将其发送到firestore

正如Doug Stevenson在中所说,您可以在firestore文档中存储原始数据。对于特定的颤振,必须从对象创建一个
Blob
。看见要转换为
Blob
构造函数采用的
Uint8List
,请参阅将Dart对象转换为JSON字符串并将此字符串转换为字节数组。这似乎不是一个很好的方法,但我个人不知道任何替代方法。答案的基本要点是将对象序列化为JSON字符串

或者,如果可能,您可以创建一个转换方法,将对象存储为
映射
,并将其写入文档。显示了一个javascript示例,但显示了一个类似的概念