update method
Updates an existing document in the collection.
Updates a document in Firestore using the object's UID as the document ID.
The document is automatically serialized using the object's json getter.
Usage
final updatedUser = User(uid: 'user123', name: 'John Updated', email: 'john@example.com');
final userId = await userCollection.update(object: updatedUser);
print('User updated: $userId');
Parameters
- object: The object to update (must implement InterfacePlus and have a valid UID)
Returns
- String: The document ID that was updated
Requirements
- The object must have a non-null UID
- The document must exist in Firestore
Implementation
Future<String> update({required InterfacePlus object}) async {
DocumentReference ref = _getCollection.doc(object.uid);
await ref.set(object.json);
return ref.id;
}