Ok<T, E> class
final
A successful Result.
- Inheritance
- Available Extensions
Properties
-
err
→ None<
E> -
The possibly contained error.
no setteroverride
- errorOrNull → Null
-
The contained error if
this
is an Err, ornull
otherwise.no setteroverride - 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
→ Some<
T> -
The possibly contained value.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value → T
-
The contained value.
final
- valueOrNull → T
-
The contained value if
this
is an Ok, ornull
otherwise.no setteroverride
Methods
-
and<
U> (Result< U, E> other) → Result<U, E> -
Returns
other
ifthis
is an Ok, or an Err of the original error otherwise.override -
andThen<
U> (Result< U, E> calculateOther(T value)) → Result<U, E> -
Returns the result of
calculateOther
ifthis
is an Ok, or an Err of the original error otherwise.override -
contains(
T value) → bool -
Returns
true
ifthis
is an Ok with the givenvalue
.override -
containsErr(
E error) → bool -
Returns
true
ifthis
is an Err with the givenerror
.override -
inspect(
void inspect(T value)) → Ok< T, E> -
Calls inspect with the contained value if
this
is an Ok.override -
inspectErr(
void inspect(E error)) → Ok< T, E> -
Calls
inspect
with the contained error ifthis
is an Err.override -
isErrAnd(
bool condition(E error)) → bool -
Returns
true
ifthis
is an Err with a contained error that satisfiescondition
.override -
isOkAnd(
bool condition(T value)) → bool -
Returns
true
ifthis
is an Ok with a contained value that satisfiescondition
.override -
map<
U> (U map(T value)) → Ok< U, E> -
Transforms the contained value, if any, by applying map to it.
override
-
mapErr<
F> (F map(E error)) → Ok< 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, ordefaultError
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 ofcalculateDefaultError
otherwise.override -
mapOr<
U> (U map(T value), U defaultValue) → U -
Returns the contained value, if any, with
map
applied to it, ordefaultValue
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 ofcalculateDefaultValue
otherwise.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
or<
F> (Result< T, F> other) → Ok<T, F> -
Returns an Ok of the original value if
this
is an Ok, orother
otherwise.override -
orElse<
F> (Result< T, F> calculateOther(E error)) → Ok<T, F> -
Returns an Ok of the original value if
this
is an Ok, or the result ofcalculateOther
otherwise.override -
toString(
) → String -
A string representation of this object.
override
-
unwrap(
{String? msg}) → T -
Returns the contained value.
override
-
unwrapErr(
{String? msg}) → Never -
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