Result<S, E> class
sealed
Base Result class
Receives two values E
and S
as E
is an error and S
is a success.
Constructors
- Result()
-
Default constructor.
const
- Result.error(E e)
-
Build a Result that returns a Error.
factory
- Result.success(S s)
-
Build a Result that returns a Error.
factory
Properties
- hashCode → int
-
The hash code for this object.
read-onlyinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
Methods
-
isError(
) → bool - Returns true if the current result is an Error.
-
isSuccess(
) → bool - Returns true if the current result is a Success.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
tryGetError(
) → E? -
Returns the value of
E
if any. -
tryGetSuccess(
) → S? -
Returns the value of
S
if any. -
when<
W> (SuccessCallback< W, S> whenSuccess, ErrorCallback<W, E> whenError) → W - Handle the result when success or error
-
whenError<
R> (R whenError(E error)) → R? - Execute whenError if the Result is an error.
-
whenSuccess<
R> (R whenSuccess(S success)) → R? - Execute whenSuccess if the Result is a success.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited