Failure<S, E extends AppException> class
final
Represents a failed result containing an error of type E
.
Constructors
- Failure.new(E error)
-
const
Properties
- error → E
-
The error value
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isFailure → bool
-
Whether this instance represents a failed result
no setterinherited
- isSuccess → bool
-
Whether this instance represents a successful result
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- valueOrNull → S?
-
Returns the success value if present, null otherwise
no setterinherited
Methods
-
asyncFold<
T> ({required AsyncSuccessCallback< S, T> onSuccess, required AsyncFailureCallback<E, T> onFailure}) → Future<T> -
Asynchronous version of fold that handles Future operations in the success case.
override
-
fold<
T> ({required SyncSuccessCallback< S, T> onSuccess, required SyncFailureCallback<E, T> onFailure}) → T -
Transforms this result into a value of type
T
by applying the appropriate callback based on whether this is a success or failure.override -
map<
T> (T transform(S value)) → Result< T, E> -
Transforms the success value of this result while preserving the Result wrapper.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited