updateData method

  1. @override
Future<void> updateData(
  1. String collectionId,
  2. String mid,
  3. Map data
)
override

Implementation

@override
Future<void> updateData(String collectionId, String mid, Map<dynamic, dynamic> data) async {
  await initialize();

  // Map<String, Object?> converted = {};
  // for (MapEntry e in data.entries) {
  //   if (e.value is List) {
  //     converted[e.key.toString()] = FieldValue.arrayUnion(e.value);
  //   } else {
  //     converted[e.key.toString()] = e.value as Object?;
  //   }
  // }
  CollectionReference collectionRef = _db!.collection(collectionId);
  //await collectionRef.doc(mid).update(converted);
  await collectionRef.doc(mid).set(data, SetOptions(merge: true));
  // for (MapEntry e in data.entries) {
  //   if (e.value is List) {
  //     await collectionRef.doc(mid).update({e.key.toString(): FieldValue.arrayUnion(e.value)});
  //   }
  // }
  logger.finest('$mid saved');
}