Batch class Null safety

A batch is used to perform multiple operation as a single atomic unit. A Batch object can be acquired by calling Database.batch. It provides methods for adding operation. None of the operation will be executed (or visible locally) until commit() is called.

batch = db.batch();
batch.insert('Test', {'name': 'item'});
batch.update('Test', {'name': 'new_item'}, where: 'name = ?', whereArgs: ['item']);
batch.delete('Test', where: 'name = ?', whereArgs: ['item']);
results = await batch.commit();




hashCode int
The hash code for this object.
length int
Current batch size
runtimeType Type
A representation of the runtime type of the object.


apply({bool? noResult, bool? continueOnError}) Future<List<Object?>>
Runs all statements in this batch non-atomically.
commit({bool? exclusive, bool? noResult, bool? continueOnError}) Future<List<Object?>>
Commits all of the operations in this batch as a single atomic unit The result is a list of the result of each operation in the same order if noResult is true, the result list is empty (i.e. the id inserted the count of item changed is not returned.
delete(String table, {String? where, List<Object?>? whereArgs}) → void
See Database.delete
execute(String sql, [List<Object?>? arguments]) → void
See Database.execute;
insert(String table, Map<String, Object?> values, {String? nullColumnHack, ConflictAlgorithm? conflictAlgorithm}) → void
See Database.insert
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
query(String table, {bool? distinct, List<String>? columns, String? where, List<Object?>? whereArgs, String? groupBy, String? having, String? orderBy, int? limit, int? offset}) → void
See Database.query;
rawDelete(String sql, [List<Object?>? arguments]) → void
See Database.rawDelete
rawInsert(String sql, [List<Object?>? arguments]) → void
See Database.rawInsert
rawQuery(String sql, [List<Object?>? arguments]) → void
See Database.query;
rawUpdate(String sql, [List<Object?>? arguments]) → void
See Database.rawUpdate
toString() String
A string representation of this object.
update(String table, Map<String, Object?> values, {String? where, List<Object?>? whereArgs, ConflictAlgorithm? conflictAlgorithm}) → void
See Database.update


operator ==(Object other) bool
The equality operator.