SafeRepositoryHelper<ValueType> mixin

A mixin that provides a safety net for repository executions.

It forces the implementation of error mappers and provides the safeCall method to wrap potentially throwing operations into a safe Either result.

Superclass constraints
Mixin applications

Properties

hashCode int
The hash code for this object.
no setterinherited
onException RepositoryError Function(Object exception, StackTrace stackTrace)
Maps generic or unexpected Object exceptions (e.g., parsing errors) to a RepositoryError.
no setter
onInadmissibleException RepositoryError Function(InadmissibleDataSourceException exception, StackTrace stackTrace)
Maps InadmissibleDataSourceException (e.g., 400 Bad Request, 404 Not Found) to a RepositoryError.
no setter
onUnControlException RepositoryError Function(UnControlDataSourceException exception, StackTrace stackTrace)
Maps UnControlDataSourceException (e.g., 500 Server Error) to a RepositoryError.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() → void
Frees up resources and notifies the observer.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
safeCall({required FutureOr<Either<RepositoryError, ValueType>> call()}) FutureOr<Either<RepositoryError, ValueType>>
Executes a function safely, catching defined exceptions and mapping them to Left.
toString() String
A string representation of this object.
inherited

Operators

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