Result<T, E> class abstract interface

Implementers

Properties

asErr Err<T, E>
no setter
asOk Ok<T, E>
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

andThen<U, F>(Result<U, F> f(T t)) Result<U, F>
Similar to map Except you must return a new Result.
asyncAndThen<U, F>(ResultAsync<U, F> f(T t)) ResultAsync<U, F>
Similar to map Except you must return a new Result.
asyncMap<U>(Future<U> f(T t)) ResultAsync<U, E>
Maps a Result<T, E> to ResultAsync<U, E> by applying an async function to a contained Ok value, leaving an Err value untouched.
isErr() bool
Used to check if a Result is an Err
isOk() bool
Used to check if a Result is an OK
map<A>(A f(T t)) Result<A, E>
Maps a Result<T, E> to Result<U, E> by applying a function to a contained Ok value, leaving an Err value untouched.
mapErr<U>(U f(E error)) Result<T, U>
Maps a Result<T, E> to Result<T, F> by applying a function to a contained Err value, leaving an Ok value untouched.
match<A>(A ok(T t), A err(E e)) → A
Given 2 functions (one for the Ok variant and one for the Err variant) execute the function that matches the Result variant.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
orElse<A>(Result<T, A> f(E error)) Result<T, A>
Takes an Err value and maps it to a Result<T, SomeNewType>.
safeUnwrap() Stream<T>
Emulates Rust's ? operator in safeTry's body. See also safeTry.
toString() String
A string representation of this object.
inherited
unsafeUnwrap({ErrorConfig? config}) → T
This method is unsafe, and should only be used in a test environments
unsafeUnwrapErr({ErrorConfig? config}) → E
This method is unsafe, and should only be used in a test environments
unwrapOr(T v) → T
Unwrap the Ok value, or return the default if there is an Err

Operators

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

Static Methods

combine<T, E>(List<Result<T, E>> resultList) Result<List<T>, E>
fromThrowable<T, E>(T fn(), {E errorFn(Object?)?}) Result<T, E>
TODO: Need to figure out how to wrap the function instead