doBatch method

Future<List<Object?>?> doBatch(
  1. void action(
    1. BoxerTableBase clone
    ), {
  2. bool? exclusive,
})

Execute all sql in a batch(essentially transaction). See BoxerTableTranslator.resetWithItems for example usage

Implementation

Future<List<Object?>?> doBatch(void Function(BoxerTableBase clone) action, {bool? exclusive}) async {
  BoxerTableBase? clone = cloneInstance;
  assert(clone != null, '❗️❗️❗️You should implement the clone() method if u want use this [doBatch] method');
  if (clone == null) return null;
  clone.batch = clone.database.batch();
  action(clone);
  return await clone.batch?.commit(exclusive: exclusive);
}