Result<S, F extends Exception> class sealed

A value that represents either a success or a failure, including an associated value in each case.

Implementers

Constructors

Result()

Properties

failure → F
Returns a new value of Failure result.
no setter
hashCode int
The hash code for this object.
no setterinherited
isFailure bool
Returns true if Result is Failure.
no setter
isSuccess bool
Returns true if Result is Success.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
success → S
Returns a new value of Success result.
no setter

Methods

flatMap<U, E extends Exception>(Result<U, F> transform(S)) Result<U, F>
Maps a Result<S, F> to Result<U, F> by applying a function to a contained Success value and unwrapping the produced result, leaving an Failure value untouched.
flatMapError<V, E extends Exception>(Result<S, E> transform(F)) Result<S, E>
Maps a Result<S, F> to Result<S, E> by applying a function to a contained Failure value, leaving an Success value untouched.
map<U, E extends Exception>(U transform(S)) Result<U, F>
Maps a Result<S, F> to Result<U, F> by applying a function to a contained Success value, leaving an Failure value untouched. This function can be used to compose the results of two functions.
mapError<V, E extends Exception>(E transform(F)) Result<S, E>
Maps a Result<S, F> to Result<S, E> by applying a function to a contained Failure value, leaving an Success value untouched.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
result(Completion<S> success, Completion<F> failure) → void
Returns a new value of Result from closure either a success or a failure.
toString() String
A string representation of this object.
inherited
unwrap() → S
Unwraps the Result and returns the Success value.
unwrapOr<T>(T initial) → S
Unwraps the Result and returns the Success value. If the result is a Success, returns the success value. If the result is a Failure, returns the provided initial value as a Success.
unwrapOrElse<T extends Object>(T t, S operation(T)) → S
Unwraps the Result and returns the Success value. If the result is a Success, returns the success value. If the result is a Failure, returns the provided initial value as a Success.

Operators

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