destroyModel method

Future<void> destroyModel(
  1. T model
)

Deletes a model instance from the database.

Implementation

Future<void> destroyModel(T model) async {
  final id = model.id;
  if (id == null) {
    throw StateError('Cannot delete a model that has not been persisted');
  }
  await destroy(id);
  model.id = null;
}