В приложении Flutter, использующем cloud_firestore для доступа к базе данных документов Cloud Firestore, при отладке я получаю следующие предупреждения / ошибки в консоли ...
4.13.0 - [Firebase/Firestore][I-FST000001] The behavior for system Date objects stored in Firestore is going to change AND YOUR APP MAY BREAK.
To hide this warning and ensure your app does not break, you need to add the following code to your app before calling any other Cloud Firestore methods:
let db = Firestore.firestore()
let settings = db.settings
settings.areTimestampsInSnapshotsEnabled = true
db.settings = settings
With this change, timestamps stored in Cloud Firestore will be read back as Firebase Timestamp objects instead of as system Date objects. So you will also need to update code expecting a Date to instead expect a Timestamp. For example:
// old:
let date: Date = documentSnapshot.get("created_at") as! Date
// new:
let timestamp: Timestamp = documentSnapshot.get("created_at") as! Timestamp
let date: Date = timestamp.dateValue()
Please audit all existing usages of Date when you enable the new behavior. In a future release, the behavior will be changed to the new behavior, so if you d<…>
Я пытаюсь определить, как сделатьэти изменения настроек / конфигурации в пакете Flutter cloud_firestore (который включает в себя собственные пакеты).
Я статически загружаю объект firestore при запуске основного приложения и добавляю его в пакет промежуточного программного обеспечения для редуксов, который сохраняется во всем приложении.Поэтому я подумал, что добавлю что-то вроде этой статической функции ...
static Firestore getStartupFirestore() {
var fs = Firestore.instance;
// #TODO: adapt this code to Dart for Flutter implementation
// let db = Firestore.firestore()
// let settings = db.settings
// settings.areTimestampsInSnapshotsEnabled = true
// db.settings = settings
return fs;
}
Но я не вижу выставленных здесь объектов настроек.
Кто-нибудь знает, есть ли другое место?где эти параметры могут быть настроены, или эта функциональность еще не была передана в реализации Flutter / Dart cloud_firestore?