SqlBuilder.delete constructor

SqlBuilder.delete(
  1. String table, {
  2. String? where,
  3. List<Object?>? whereArgs,
})

Convenience method for deleting rows in the database.

@param table the table to delete from @param where the optional WHERE clause to apply when deleting. Passing null will delete all rows. @param whereArgs You may include ?s in the where clause, which will be replaced by the values from whereArgs. The values will be bound as Strings.

Implementation

SqlBuilder.delete(String table, {String? where, List<Object?>? whereArgs}) {
  checkWhereArgs(whereArgs);
  final delete = StringBuffer();
  delete.write('DELETE FROM ');
  delete.write(_escapeName(table));
  _writeClause(delete, ' WHERE ', where);
  sql = delete.toString();
  arguments = whereArgs != null ? List<Object?>.from(whereArgs) : null;
}