update_field_value_in_collection function

dynamic update_field_value_in_collection({
  1. required String field,
  2. required dynamic value,
  3. required String collection,
})

Implementation

update_field_value_in_collection({
  required String field,
  required dynamic value,
  required String collection,
}) async {
  QuerySnapshot collection_snapshot =
      await FirebaseFirestore.instance.collection(collection).get();

  for (var document in collection_snapshot.docs) {
    document.reference.update({field: value});
    collection_counter++;
  }
  print_collection_counter();
}