Failure<S, F> class
Represents a failed result.
Constructors
- Failure(F value, [Object? exception, StackTrace? stackTrace])
-
Represents a failed result.
const
Properties
- asFailure → F
-
Returns the failure value of the result.
no setterinherited
- asSuccess → S
-
Returns the success value of the result.
no setterinherited
- exception → Object?
-
The exception that caused the failure, if available.
final
- failed → bool
-
Returns 'true' if the type is a failure, otherwise 'false'.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
-
props
→ List<
Object?> -
The list of properties that will be used to determine whether
two instances are equal.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stackTrace → StackTrace?
-
The stack trace of the failure, if available.
final
- stringify → bool?
-
If set to
true, the toString method will be overridden to output this instance's props.no setterinherited - succeeded → bool
-
Returns 'true' if the type is a success, otherwise 'false'.
no setterinherited
- val → F
-
A short version of value.
no setter
- value → F
-
The failure value.
final
Methods
-
convert<
S2> (S2 onSuccess(S success)) → Result< S2, F> -
Converts the success type of the result.
inherited
-
convertBoth<
S2, F2> ({required S2 onSuccess(S success), required F2 onFailure(F failure)}) → Result< S2, F2> -
Converts both the success and failure types of the result.
inherited
-
convertFailure<
F2> (F2 onFailure(F failure)) → Result< S, F2> -
Converts the failure type of the result.
inherited
-
ensure(
{required bool check(S success), required F otherwise(S success)}) → Result< S, F> -
Ensures that a success value satisfies a condition, otherwise converts it
to a failure.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
recoverWhen(
{required bool check(F failure), required S then(F failure)}) → Result< S, F> -
Recovers from a failure when a specified condition is met.
inherited
-
resolve<
T> ({required T onSuccess(S success), required T onFailure(F failure)}) → T -
Resolves the result into a single type.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited