flutterfire icon indicating copy to clipboard operation
flutterfire copied to clipboard

🐛 Firestore Support ServerTimestampBehavior

Open galacticgibbon opened this issue 3 years ago • 2 comments

This Issue was supposedly fixed, but I think the person that closed it misunderstood the request

https://github.com/firebase/flutterfire/issues/859

It would be nice to support ServerTimestampBehavior so that server timestamps will always resolve as an actual DateTime

galacticgibbon avatar Apr 08 '22 16:04 galacticgibbon

The linked issue addressed by adding serverTimeStamp https://pub.dev/documentation/cloud_firestore/latest/cloud_firestore/FieldValue/serverTimestamp.html

This request is to add serverTimeStampBehavior as mentioned in https://firebase.google.com/docs/reference/android/com/google/firebase/firestore/DocumentSnapshot.ServerTimestampBehavior

darshankawar avatar Apr 11 '22 12:04 darshankawar

Some background on this;

The reason this isn't implemented is because by the time the snapshot is returned back to the user (in Dart land) we've already called the snapshot method in native code. Therefore adding the option to the Dart code wouldn't work since it's too late.

To support this, maybe we need to add the behaviour to GetOptions, which we store, and when returning the snapshot on native we provide that option. This however differs from the official SDK implementation so we'd need to get the OK on this API change.

Ehesp avatar Apr 21 '22 16:04 Ehesp

Hey, closing this issue off so we can keep track on https://github.com/firebase/flutterfire/issues/9859 - we just need to confirm the correct API for this.

Ehesp avatar Nov 04 '22 09:11 Ehesp