destroyModel method
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;
}