Result<T, E> class
An object that can contain either a successful result (of type T), or
an error (of type E).
Use the Result.ok
and Result.error
constructors to create these.
Constructors
- Result({T? object, E? error})
-
const
- Result.error(E error)
-
A failed result.
factory
- Result.ok(T object)
-
A successful result.
factory
Properties
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
-
transform<
X> (Result< X, E> transformer(T e)) → Result<X, E> -
Transforms a Result<T, E> into a Result<X, E> through
transformer
. If the Result this is called on has an error, it will be passed on, and if it is ok then thetransformer
will be applied.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited