ServerValue timestamp

432 views
Skip to first unread message

David Carr

unread,
Dec 11, 2017, 8:47:19 PM12/11/17
to Flutter Dev
Hello,

I'm trying to set the server time on my setData() for the cloud_firestore plugin. Could someone tell me what I'm doing wrong?
Firestore.instance
          .collection('posts/' + widget.id + '/comments')
          .document()
          .setData(<String, dynamic>{
          'author':  'James', 
          'text':  'this is comment text',
          'timestamp': ServerValue.timestamp,
});

Günter Zöchbauer

unread,
Dec 13, 2017, 12:20:29 PM12/13/17
to Flutter Dev
Do you get an error?
Is anything of your value persisted on the server?

Kyle Bradshaw

unread,
Dec 13, 2017, 3:49:49 PM12/13/17
to Flutter Dev
As of right now, the Firestore plugin does not support ServerValue.timestamp (or DateTimes). Feel free to create an issue specifically about this.

Kyle Bradshaw

unread,
Dec 13, 2017, 3:54:30 PM12/13/17
to Flutter Dev
Actually, investigating a little further, it seems ServerValue.timestamp should only be valid for Firebase Database, not Firestore.

A method exists to get the server timestamp in Firestore, but isn't implemented in the plugin yet.

Collin Jackson

unread,
Dec 14, 2017, 12:53:30 PM12/14/17
to Kyle Bradshaw, Flutter Dev
Here's the open issue and the in-progress pull request to fix it.

--
You received this message because you are subscribed to the Google Groups "Flutter Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Exx Navarro

unread,
Jun 4, 2018, 6:22:12 AM6/4/18
to Flutter Dev
Any luck on this? 
Reply all
Reply to author
Forward
0 new messages