Result<T, E> class sealed

A result of a computation that can succeed or fail.

Implementers
Available extensions

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

bimap<U, F>(U f(T), F g(E)) Result<U, F>
Map a function, f, over the value of a successful Result and a function, g, over the reason of an unsuccessful Result.
failureOrNull() → E?
Returns the failure reason, or null if the Result is a success.
filterNotNull(E failureDescription()) Result<T, E>

Available on Result<T?, E>, provided by the ResultNullableExtensions extension

Convert a Success of a nullable value to a Success of a non-null value or a Failure, using failureDescription as the failure reason, if the value is null.
flatMap<U>(Result<U, E> f(T)) Result<U, E>
Flat-map a function over the value of a successful Result.
flatMapFailure<F>(Result<T, F> f(E)) Result<T, F>
Flat-map a function over the reason of an unsuccessful Result.
fold<U>(U f(T), U g(E)) → U
Fold a function, f, over the value of a successful Result and a function, g, over the reason of an unsuccessful Result where both functions result in a value of the same type.
get() → T

Available on Result<T, T>, provided by the ResultSameType extension

Unwrap a Result in which both the success and failure values have the same type.
map<U>(U f(T)) Result<U, E>
Map a function over the value of a successful Result.
mapFailure<F>(F f(E)) Result<T, F>
Map a function over the reason of an unsuccessful Result.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onNull(Never block()) Result<T, E>

Available on Result<T?, E>, provided by the ResultNullableExtensions extension

Convert a Success of a nullable value to a Success of a non-null value, or calling block to abort if the value is null.
peek(void f(T)) Result<T, E>
Perform a side effect with the success value.
peekFailure(void f(E)) Result<T, E>
Perform a side effect with the failure reason.
toString() String
A string representation of this object.
inherited
valueOrNull() → T?
Returns the success value, or null if the Result is a failure.

Operators

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