update method
dynamic
update(
- dynamic field,
- dynamic value,
- Map<String, dynamic> data
)
Implementation
update(field, value, Map<String, dynamic> data) {
if (field == null && value == null) {
throw Exception('Field $field not found');
} else if (fields.where((element) => element.field == field).isEmpty) {
throw Exception('Field $field not found');
}
database().where(field, isEqualTo: value).get().then((value) {
for (var element in value.docs) {
element.reference.update(data);
}
});
firestore.collection('Xactivity').add({
'activity': 'Updated $className',
'time': DateTime.now(),
'by' : FirebaseAuth.instance.currentUser!.email,
});
}