update method

  1. @override
Future<void> update(
  1. String id,
  2. T value
)
override

Implementation

@override
Future<void> update(String id, T value) async {
  final list = await getAll();
  final index = list.indexWhere((e) => getId(e) == id);
  if (index == -1) throw Exception('id: $id Not Found!');
  list[index] = value;
  notify(TDatabaseListenerTypes.update, id);
  await save(list);
}