delete method
Implementation
@override
Future<int> delete({
Filter Function(TMeta t)? where,
bool? useIsolate,
bool all = false,
}) async {
assert(
all || where != null,
'Either provide where query or specify all = true to delete all.',
);
final db = await dbContext.database;
final formattedQuery =
where != null ? await whereString(where, useIsolate: useIsolate) : null;
return db.transaction<int>((txn) async {
final batch = txn.batch()
..delete(
t.tableName,
where: formattedQuery?.filter,
whereArgs: formattedQuery?.whereArgs,
);
final result = await batch.commit(
noResult: false,
continueOnError: false,
);
if (result.isEmpty) {
return 0;
}
final res = result[0];
if (res is int) {
return res;
}
return 0;
});
}