delete method

  1. @override
Future<void> delete(
  1. String key, {
  2. bool notify = true,
})
override

Deletes model of type T with key from local storage.

By default notifies this modification to the associated GraphNotifier.

Implementation

@override
Future<void> delete(String key, {bool notify = true}) async {
  if (box == null) return;
  final delete = box!.delete(key); // delete in bg
  final id = graph.getIdForKey(key);
  if (id != null) {
    graph.removeId(internalType, id, notify: false);
  }
  graph.removeKey(key);
  await delete;
}