updateDocument method

  1. @override
Future<void> updateDocument(
  1. String collection,
  2. String id,
  3. Map<String, dynamic> data
)

Updates a document in the specified collection

Implementation

@override
Future<void> updateDocument(
  String collection,
  String id,
  Map<String, dynamic> data,
) async {
  final documents = _documents;
  final name = _documentPath(collection, id);
  final fields = _encodeFields(data);

  final document = firestore.Document(
    name: name,
    fields: fields,
  );

  await documents.patch(
    document,
    name,
    updateMask_fieldPaths: fields.keys.toList(),
  );
}