overwrite method

  1. @override
Future<String?> overwrite(
  1. String path,
  2. Map<String, dynamic> data
)
override

Overwrites a Firestore document with the provided data.

This method replaces the entire document with the provided data, removing any existing fields not included in the new data.

  • path: The path to the document.
  • data: The data to replace the document with.

Implementation

@override
Future<String?> overwrite(String path, Map<String, dynamic> data) async {
  try {
    await datasource.doc(path).set(data, SetOptions(merge: false));
    return null;
  } catch (e) {
    return e.toString();
  }
}