Result<ValueT, FailureT extends Exception> class abstract

An operation's result. Can be a success or a failure.

Implementers
Annotations

Constructors

Result.failure(FailureT failure)
const
factory
Result.success(ValueT value)
const
factory

Properties

failureOrNull → FailureT?
no setter
hashCode int
The hash code for this object.
no setterinherited
isFailure bool
no setter
isValue bool
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
valueOrNull → ValueT?
no setter
valueOrThrow → ValueT
Returns the value if it is a success. Else, throws the error as an Exception.
no setter

Methods

map<T>({required T success(ResultSuccess<ValueT, FailureT> result), required T failure(ResultFailure<ValueT, FailureT> result)}) → T
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
when<T>({required T success(ValueT value), required T failure(FailureT failure)}) → T

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

guard<ValueT>(Future<ValueT> run()) Future<Result<ValueT, Failure>>
Transforms exceptions into Failure.other.