Flutter Firestore Server side Timestamp

2020-02-28 00:38发布

问题:

I need to add a server side timestamp on new documents added to Firestore using a Flutter app. I see I am supposed to use FieldValue.serverTimestamp but I am not sure where to find this.

回答1:

As of September 5th, the updated cloud_firestore v0.8.0 library now has FieldValue.serverTimestamp(). All is now well in the universe



回答2:

'timestamp' : Timestamp.now()

Timestamp.now() is part of cloud_firestore;