clearLocal method

Future<void> clearLocal({
  1. bool notify = true,
})
inherited

Deletes all models of type T in local storage.

Async in case some implementations need to remove files.

Implementation

Future<void> clearLocal({bool notify = true}) async {
  final _ = db.select('DELETE FROM $internalType RETURNING key;');
  final keys =
      _.map((e) => (e['key'] as int).typifyWith(internalType)).toList();
  await core.deleteKeys(keys);

  if (notify) {
    core._notify([internalType], type: DataGraphEventType.clear);
  }
}