DatumEither<L, R> class
sealed
A sealed class representing a value that can be one of two types.
This is often used to represent a value that can be either a success or a failure.
By convention, L is the error type and R is the success type.
Properties
- errorOrNull → L?
-
Returns the error value, or
nullif this is aSuccess.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
- successOrNull → R?
-
Returns the success value, or
nullif this is aFailure.no setter
Methods
-
fold<
T> (T onFailure(L l, StackTrace? s), T onSuccess(R r)) → T -
Folds the
Eitherinto a single value. -
getError(
) → (L, StackTrace?) -
Returns the failure value, or throws an exception if this is a
Success. -
getSuccess(
) → R -
isFailure(
) → bool -
Returns
trueif this is aFailure. -
isSuccess(
) → bool -
Returns
trueif this is aSuccess. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onFailure(
void onFailure(L l, StackTrace? s)) → void - Performs an action on the failure value.
-
onSuccess(
void onSuccess(R r)) → void - Performs an action on the success value.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited