Result<T> class
A monad wrapping a non-nullable type T
alongside the possible
error.
Constructors
- Result.error(Object error)
-
Creates a new error Result with the given error.
const
- Result.success(T? _result)
-
Creates a new success Result with the given result.
const
Properties
- error → Object?
-
The error which may have occurred.
If the error has not occurred, it will ne null.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasResult → bool
-
Returns true if no error has occurred during the API request.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
map<
T1> (T1 mapper(T)) → Result< T1> -
Maps this Result of type
T
to an ErrorWrapper of typeT1
with the givenmapper
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
result(
) → T -
Returns a wrapped object of type
T
, if the result is present. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited