Result<T> class sealed

Result class to handle success and failure states.

Implementers
Annotations

Constructors

Result.failure(Object? error)
factory
Result.success(T value)
factory

Properties

errorOrNull → Object?
Returns the exception if Result is Failure or null otherwise.
no setter
getOrNull → T?
Returns the value if Result is Success or null otherwise.
no setter
hashCode → int
The hash code for this object.
no setterinherited
isFailure → bool
Returns true if Result is Failure.
no setter
isSuccess → bool
Returns true if Result is Success.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

map<R>(R transform(T value)) → Result<R>
Maps the value of Result if it is Success or returns the same Result otherwise.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited
when<TResult extends Object?>({required TResult success(T response), required TResult error(Object? error)}) → TResult
Maps the value of the result and returns the error or success TResult

Operators

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