update method

Transaction update(
  1. DocumentReference docRef,
  2. Map<Object?, Object?> data, [
  3. Precondition? precondition
])

Updates fields provided in data for the document referred to by docRef.

Only the fields specified in data will be updated. Fields that are not specified in data will not be changed.

If the document does not yet exist, it will fail.

Implementation

Transaction update(
  DocumentReference<dynamic> docRef,
  Map<Object?, Object?> data, [
  Precondition? precondition,
]) {
  _transactionWriteBatch.update(
    docRef,
    {
      for (final entry in data.entries)
        FieldPath.from(entry.key): entry.value,
    },
    precondition: precondition,
  );

  return Transaction._(_firestore, _transactionId, _transactionWriteBatch);
}