Skip to content

cloud_firestore should have FieldValue support #13905

@Skylled

Description

@Skylled

At present it is impossible to delete a field from a Document, or use the server's timestamp in a field.

These are minor issues and can be worked around by nullifying the field or using DateTime.now() respectively.

The Firestore APIs have FieldValue.delete and FieldValue.serverTimestamp for these tasks, and the Flutter API should probably support them at some point.

These are very easily implemented on iOS, as shown by @ananfang, however on the Java side, there's a blocking issue. Namely, trying to route com.google.firebase.firestore.FieldValue through the Message codec triggers the following error:

E/MethodChannel#plugins.flutter.io/cloud_firestore(29782): Failed to handle method call
E/MethodChannel#plugins.flutter.io/cloud_firestore(29782): java.lang.RuntimeException: No properties to serialize found on class com.google.firebase.firestore.FieldValue$zzb

Searching for this error turns up in Google Cloud Java and seems to be due to the way FieldValue is implemented in that it simply returns an Object(). This is assuming the Android implementation is the same as GCJ's, but I can't verify that as Firebase for Android does not seem to be open source.

I'm opening this issue in hopes that someone on the team will know who to cc about this.

Metadata

Metadata

Assignees

Labels

p: cloud_firestoreFirebase Firestore pluginp: firebaseFirebase pluginspackageflutter/packages repository. See also p: labels.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions