You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 28, 2026. It is now read-only.
I am currently working on a project that extensively uses cloud_firestore_odm, and have come across a scenario wherein I would like to keep the field decorated with @id in the Firestore document data.
The issue arises with the generated code:
static Map<String, Object?> toFirestore(
User value,
SetOptions? options,
) {
return {...value.toJson()}..remove('uid');
}
Here, the uid field, which is the @id decorated in my case, is consistently removed with every document update.
Upon referring to the Firestore documentation, it becomes evident that the @id field is not included in the Firestore object when encoded, by default. However, my requirement contradicts this default behavior, and I would like to preserve the @id field.
Could anyone guide me on how to stop cloud_firestore_odm from removing the uid field, which is marked with @id annotation, when encoding a Document? Any input on this would be greatly appreciated.
copied from firebase/flutterfire#11939