update method

Future<String> update(
  1. Map<String, dynamic> data
)

Updates data on the document. Data will be merged with any existing document data.

Objects key can be a String or a FieldPath.

return id

Implementation

Future<String> update(Map<String, dynamic> data) async {
  try {
    await _reference.update(data);
  } on FirebaseException catch (e) {
    if (e.code == 'not-found') {
      await _reference.set({});
      await _reference.update(data);
    } else {
      rethrow;
    }
  }
  final id = getID();

  return id;
}