ErrFlow<T> class

A class that facilitates handling and logging of errors.

Constructors

ErrFlow([T? defaultValue])
Creates an ErrFlow that facilitates handling and logging of errors.

Properties

criticalErrorHandler ↔ (void Function<S>(S, T?)?)
The default error handler function for critical errors.
getter/setter pair
defaultValue → T?
A getter for the value that was set in the constructor and is used as the initial value for lastError in an object of the ErrNotifier class and its variants in each scope().
no setter
errorHandler ↔ (void Function<S>(S, T?)?)
The default error handler function for non-critical errors.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
logger ↔ (FutureOr<void> Function(Object, StackTrace?, {Object? reason})?)
A logger function that is called when an error is notified.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addListener(ErrListener<T> listener) → void
Registers a listener, which is a function to be called when new error information is set by ErrNotifier.set(), ErrNotifier.log(), LoggingErrNotifier.set() or LoggingErrNotifier.log().
combiningScope<S>(FutureOr<S> process(LoggingErrNotifier<T>)) Future<CombinedResult<S, T>>
Executes the provided function process with an object of LoggingErrNotifier passed to it.
dispose() → void
Discards the resources used by the object. After this is called, the object is not in a usable state and should be discarded.
ignorableScope<S>(FutureOr<S> process(IgnorableErrNotifier<T>)) Future<S>
Executes the provided function process with an object of IgnorableErrNotifier passed to it.
loggingScope<S>(FutureOr<S> process(LoggingErrNotifier<T>)) Future<S>
Executes the provided function process with an object of LoggingErrNotifier passed to it.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeListener(ErrListener<T> listener) → void
Removes a previously registered listener from the list of listeners. If the given listener is not registered, the call is ignored.
scope<S>(FutureOr<S> process(ErrNotifier<T>), {bool errorIf(S, T?)?, bool criticalIf(S, T?)?, void onError(S, T?)?, void onCriticalError(S, T?)?}) Future<S>
Executes the provided function process, and then calls either of the onError and onCriticalError callbacks if the condition specified by errorIf or criticalIf is met respectively at the point when the process ends.
toString() String
A string representation of this object.
override
useDefaultLogger() → void
Sets the default logger to be used, which outputs information such as the message of an exception and the stack trace to the console.

Operators

operator ==(Object other) bool
The equality operator.
inherited