Err<T extends Object, E extends Object> class

A type that represent a err TaskResult.

Inheritance

Constructors

Err(E error)
Creates an err result with given error.
const

Properties

data → T?
Returns the data of the result, this value will not be null if isOk is true.
no setterinherited
error → E?
Returns the error of the result, this value will not be null if isErr is true.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
isErr bool
Returns true if the result is err, which means error is not null.
no setterinherited
isOk bool
Returns true if the result is ok, which means data is not null.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

and<U extends Object>(TaskResult<U, E> res) TaskResult<U, E>
Returns res if ok, otherwise returns error in corresponding type.
inherited
andThen<U extends Object>(TaskResult<U, E> op(T data)) TaskResult<U, E>
Returns the result computed by op, otherwise returns error in corresponding type.
inherited
andThenAsync<U extends Object>(FutureOr<TaskResult<U, E>> op(T data)) Future<TaskResult<U, E>>
This is the async version of andThen.
inherited
expect(Object msg) → T
Unwraps the result, returns data if ok, otherwise throws given msg.
inherited
expectErr(Object msg) → E
Unwraps the result, returns error if err, otherwise throws given msg.
inherited
inspect(void op(T data)) TaskResult<T, E>
Calls given op if ok and returns the result as is.
inherited
inspectAsync(FutureOr<void> op(T data)) Future<TaskResult<T, E>>
This is the async version of inspect.
inherited
inspectErr(void op(E error)) TaskResult<T, E>
Calls given op if err and returns the result as is.
inherited
inspectErrAsync(FutureOr<void> op(E error)) Future<TaskResult<T, E>>
This is the async version of inspectErr.
inherited
map<U extends Object>(U op(T data)) TaskResult<U, E>
Maps the result to result with data computed by given op.
inherited
mapAsync<U extends Object>(FutureOr<U> op(T data)) Future<TaskResult<U, E>>
This is the async version of map.
inherited
mapErr<F extends Object>(F op(E error)) TaskResult<T, F>
Maps the result to result with target error computed by given op.
inherited
mapErrAsync<F extends Object>(FutureOr<F> op(E error)) Future<TaskResult<T, F>>
This is the async version of mapOrElse.
inherited
mapOr<U extends Object>(U defaultValue, U op(T data)) TaskResult<U, E>
Maps the result to result with data computed by given defaultValue value and op.
inherited
mapOrAsync<U extends Object>(U defaultValue, FutureOr<U> op(T data)) Future<TaskResult<U, E>>
This is the async version of mapOr.
inherited
mapOrElse<U extends Object>(U defaultValue(E error), U op(T data)) TaskResult<U, E>
Maps the result to result with data computed by given defaultValue and op.
inherited
mapOrElseAsync<U extends Object>(FutureOr<U> defaultValue(E error), FutureOr<U> op(T data)) Future<TaskResult<U, E>>
This is the async version of mapOrElse.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
or<F extends Object>(TaskResult<T, F> res) TaskResult<T, F>
Returns res if err, otherwise returns data in corresponding type.
inherited
orElse<F extends Object>(TaskResult<T, F> op(E error)) TaskResult<T, F>
Returns the result computed by op, otherwise returns data in corresponding type.
inherited
orElseAsync<F extends Object>(FutureOr<TaskResult<T, F>> op(E error)) Future<TaskResult<T, F>>
This is the async version of orElse.
inherited
toString() String
A string representation of this object.
inherited
unwrap() → T
Unwraps the result, returns data if ok, otherwise throws error.
inherited
unwrapErr() → E
Unwraps the result, returns error if err, otherwise throws data.
inherited
unwrapOr(T defaultValue) → T
Unwraps the result, returns data if ok, otherwise returns given defaultValue.
inherited
unwrapOrElse(T op(E error)) → T
Unwraps the result, returns data if ok, otherwise computes it from given op.
inherited
unwrapOrElseAsync(FutureOr<T> op(E error)) Future<T>
This is the async version of unwrapOrElse.
inherited

Operators

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