flutterfire
flutterfire copied to clipboard
🐛 Firestore Support ServerTimestampBehavior
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
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
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.
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.