RxResult<T> class sealed

Result wrapper for operations that can fail

Implementers

Properties

errorOrNull RxException?
Get the error if failed, or null if successful
no setter
hashCode int
The hash code for this object.
no setterinherited
isFailure bool
Whether this result represents failure
no setter
isSuccess bool
Whether this result represents success
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value → T
Get value or throw exception
no setter
valueOrNull → T?
Get the value if successful, or null if failed
no setter

Methods

flatMap<R>(RxResult<R> transform(T value)) RxResult<R>
Chain operations that return RxResult
map<R>(R transform(T value)) RxResult<R>
Transform the value if successful, or return the failure
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onFailure(void callback(RxException error)) → void
Execute callback if failed
onSuccess(void callback(T value)) → void
Execute callback if successful
toString() String
A string representation of this object.
inherited
valueOr(T fallback) → T
Get value or return fallback
valueOrElse(T fallback()) → T
Get value or compute fallback

Operators

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

Static Methods

failure<T>(RxException error) RxResult<T>
success<T>(T value) RxResult<T>
Factory constructors
tryExecute<T>(T operation(), [String? context]) RxResult<T>
Try to execute a function and wrap result
tryExecuteAsync<T>(Future<T> operation(), [String? context]) Future<RxResult<T>>
Try to execute an async function and wrap result