Failure<T> class final

Failure result

Inheritance

Constructors

Failure(String message, {Exception? exception})
const

Properties

dataOrNull → T?
Get data if success, null otherwise
no setterinherited
errorOrNull String?
Get error message if failure, null otherwise
no setterinherited
exception Exception?
final
exceptionOrNull Exception?
Get exception if failure, null otherwise
no setterinherited
hashCode int
The hash code for this object.
no setteroverride
isFailure bool
Check if result is failure
no setterinherited
isSuccess bool
Check if result is success
no setterinherited
message String
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

flatMap<R>(Result<R> transform(T)) Result<R>
FlatMap for chaining operations
inherited
getOrDefault(T defaultValue) → T
Get data or return default value
inherited
getOrElse(T compute(String)) → T
Get data or compute from error
inherited
getOrThrow() → T
Get data or throw exception
inherited
map<R>(R transform(T)) Result<R>
Transform the data if success
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onFailure(void callback(String, Exception?)) Result<T>
Execute callback on failure
inherited
onSuccess(void callback(T)) Result<T>
Execute callback on success
inherited
recover(T recovery(String)) Result<T>
Recover from failure
inherited
recoverWith(Result<T> recovery(String)) Result<T>
Recover from failure with Result
inherited
toString() String
A string representation of this object.
override
when<R>({required R success(T data), required R failure(String message, Exception? exception)}) → R
When pattern matching
inherited

Operators

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