ignorableScope<S> method

Future<S> ignorableScope<S>(
  1. FutureOr<S> process(
    1. IgnorableErrNotifier<T>
    )
)

Executes the provided function process with an object of IgnorableErrNotifier passed to it.

IgnorableErrNotifier.set() and IgnorableErrNotifier.log() do not trigger the error handlers, the logger, nor added listener functions. Note, however, that IgnorableErrNotifier.set() updates the value of ErrNotifier.lastError.

This is useful when you want to prevent the error handlers and the logger from being triggered even if set() and log() are called inside process.

Implementation

Future<S> ignorableScope<S>(
  FutureOr<S> Function(IgnorableErrNotifier<T>) process,
) async {
  assert(_debugAssertNotDisposed());

  final newNotifier = IgnorableNotifier.from(_notifier);
  final result = await process(newNotifier);
  newNotifier.dispose();

  return result;
}