deleteObjet<T> method

Future<bool> deleteObjet<T>([
  1. String? afterWhere
])

Deletes rows of T matching afterWhere. When afterWhere is null every row of the table is removed (the table itself is preserved).

Throws DatabaseException if the entity table does not exist.

Implementation

Future<bool> deleteObjet<T>([String? afterWhere]) async {
  final String whereClause =
      afterWhere != null ? 'WHERE ${_sanitizeWhere(afterWhere)}' : '';
  final int affected = await (await db).transaction(
    (txn) => txn.rawDelete('DELETE FROM ${T.toString()} $whereClause'),
  );
  return affected > 0;
}