Err<T, E> class final

An erroneous Result.

Inheritance
Available extensions

Constructors

Err(E error)
Creates an erroneous Result with the given error.
const

Properties

err → Some<E>
The possibly contained error.
no setteroverride
error → E
The contained error.
final
error → E

Available on Result<Never, E>, provided by the ErroneousResult extension

Returns the contained error.
no setter
errorOrNull → E
The contained error if this is an Err, or null otherwise.
no setteroverride
flattened → Result<T, E>

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

Flattens a Result containing another Result.
no setter
hashCode → int
The hash code for this object.
no setteroverride
isErr → bool
Whether this is an Err.
no setteroverride
isOk → bool
Whether this is an Ok.
no setteroverride
iterable → Iterable<T>
Returns an iterable over the possibly contained value.
no setteroverride
ok → None<T>
The possibly contained value.
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
transposed → Option<Result<T, E>>

Available on Result<Option<T>, E>, provided by the TransposedResult extension

A Result containing an Option transposed into an Option containing a Result.
no setter
value → T

Available on Result<T, Never>, provided by the SuccessfulResult extension

Returns the contained value.
no setter
valueOrNull → Null
The contained value if this is an Ok, or null otherwise.
no setteroverride

Methods

and<U>(Result<U, E> other) → Err<U, E>
Returns other if this is an Ok, or an Err of the original error otherwise.
override
andThen<U>(Result<U, E> calculateOther(T value)) → Err<U, E>
Returns the result of calculateOther if this is an Ok, or an Err of the original error otherwise.
override
contains(T value) → bool
Returns true if this is an Ok with the given value.
override
containsErr(E error) → bool
Returns true if this is an Err with the given error.
override
inspect(void inspect(T value)) → Err<T, E>
Calls inspect with the contained value if this is an Ok.
override
inspectErr(void inspect(E error)) → Err<T, E>
Calls inspect with the contained error if this is an Err.
override
isErrAnd(bool condition(E error)) → bool
Returns true if this is an Err with a contained error that satisfies condition.
override
isOkAnd(bool condition(T value)) → bool
Returns true if this is an Ok with a contained value that satisfies condition.
override
map<U>(U map(T value)) → Err<U, E>
Transforms the contained value, if any, by applying map to it.
override
mapErr<F>(F map(E error)) → Err<T, F>
Transforms the contained error, if any, by applying map to it.
override
mapErrOr<F>(F map(E error), F defaultError) → F
Returns the contained error, if any, with map applied to it, or defaultError otherwise.
override
mapErrOrElse<F>(F map(E error), F calculateDefaultError(T value)) → F
Returns the contained error, if any, with map applied to it, or the result of calculateDefaultError otherwise.
override
mapOr<U>(U map(T value), U defaultValue) → U
Returns the contained value, if any, with map applied to it, or defaultValue otherwise.
override
mapOrElse<U>(U map(T value), U calculateDefaultValue(E error)) → U
Returns the contained value, if any, with map applied to it, or the result of calculateDefaultValue otherwise.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
or<F>(Result<T, F> other) → Result<T, F>
Returns an Ok of the original value if this is an Ok, or other otherwise.
override
orElse<F>(Result<T, F> calculateOther(E error)) → Result<T, F>
Returns an Ok of the original value if this is an Ok, or the result of calculateOther otherwise.
override
toString() → String
A string representation of this object.
override
unwrap({String? msg}) → Never
Returns the contained value.
override
unwrapErr({String? msg}) → E
Returns the contained error.
override
unwrapErrOr(E defaultError) → E
Returns the contained error, if any, or defaultError otherwise.
override
unwrapErrOrElse(E calculateDefaultError(T value)) → E
Returns the contained error, if any, or the result of calculateDefaultError otherwise.
override
unwrapOr(T defaultValue) → T
Returns the contained value, if any, or defaultValue otherwise.
override
unwrapOrElse(T calculateDefaultValue(E error)) → T
Returns the contained value, if any, or the result of calculateDefaultValue otherwise.
override

Operators

operator ==(covariant Result<T, E> other) → bool
The equality operator.
override