doTransaction<T> method

Future<T?> doTransaction<T>(
  1. Future<T?> action(
    1. BoxerTableBase clone
    ), {
  2. bool? exclusive,
})

Execute all sql in a transaction. See BoxerTableTranslator.resetWithItems for example usage

Implementation

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