replaceFields method

  1. @override
Future<void> replaceFields({
  1. required DocumentId docId,
  2. required T value,
  3. required List<String> fieldPaths,
})
override

Replaces the fields of the document at docId with the matching fieldPaths from value

Converts all fieldPaths into FieldPath objects to compare against

If no document exists yet, the update will fail silently.

Implementation

@override
Future<void> replaceFields({
  required DocumentId docId,
  required T value,
  required List<String> fieldPaths,
}) async {
  final replacement = value.toIsolatedJson(fieldPaths);

  await untypedRef.doc(docId.docId).update(replacement);

  return;
}