destroyModel method

Future<void> destroyModel(
  1. T model
)

Deletes a model instance from the database.

Implementation

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