write method

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

Writes data to a Firestore document at the specified path.

This method performs a merge operation, preserving any existing fields in the document that aren't explicitly overwritten.

  • path: The path to the document.
  • data: The data to write to the document.

Implementation

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