transaction<T> abstract method
Executes a transactional block with retry, success/failure hooks.
callbackis the block of code to run inside a transaction.retryDelaysets the delay between retries.
Hooks:
onSuccesscalled when the transaction commits successfully.onFailurecalled if the transaction throws an error.onFinallyalways called after transaction completes.
Implementation
Future<T> transaction<T>(
Future<T> Function() callback, {
Duration retryDelay = const Duration(milliseconds: 100),
Future<void> Function(T result)? onSuccess,
Future<void> Function(dynamic error)? onFailure,
Future<void> Function()? onFinally,
String? isolationLevel,
});