简体   繁体   中英

How does FlutterFire Cloud FireStore handle Dart DateTime and enum?

I can't find any data type reference guide that explains how Flutter (Dart) 'DateTime' and 'enum' data types should be represented in the Map structure passed to a FlutterFire FireStore add/update document call.

Any suggestions?

Here is an answer to another question about enums:

Flutter is able to generate JSON serialization code. It references the package json_annotation. It contains also support for enum serialization. So all you need is to use this tool and annotate your enum values with @JsonValue.

From the code docs:

An annotation is used to specify how an enum value is serialized.

For time objects the answer is from here :

Use

FieldValue.serverTimestamp()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM