sqlDelete method

Future<void> sqlDelete({
  1. String? where,
  2. bool verbose = false,
})

Delete an instance from the database

Implementation

Future<void> sqlDelete({String? where, bool verbose = false}) async {
  _checkDbIsReady();
  var _where = where;
  if (where == null) {
    assert(id != null,
        "The instance id must not be null if no where clause is used");
    _where = "id=$id";
  }
  await db!
      .delete(table: table!.name, where: _where, verbose: verbose)
      .catchError((dynamic e) =>
          throw WriteQueryException("Can not delete model from database $e"));
}