Result<T> class Null safety

The outcome of a operation.

An outcome can be either a success and return a T result or a failure and return a Failure error.

Annotations

Constructors

Result(T result)
Creates a success result of T type.
const
factory
Result.failure(Failure error)
Creates a failure result with error.
const
factory

Properties

hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

map<TResult extends Object?>(TResult $default(_ResultSuccess<T> value), {required TResult failure(_ResultFailure<T> value)}) → TResult
@optionalTypeArgs, inherited
mapOrNull<TResult extends Object?>(TResult $default(_ResultSuccess<T> value)?, {TResult failure(_ResultFailure<T> value)?}) → TResult?
@optionalTypeArgs, inherited
maybeMap<TResult extends Object?>(TResult $default(_ResultSuccess<T> value)?, {TResult failure(_ResultFailure<T> value)?, required TResult orElse()}) → TResult
@optionalTypeArgs, inherited
maybeWhen<TResult extends Object?>(TResult $default(T result)?, {TResult failure(Failure error)?, required TResult orElse()}) → TResult
@optionalTypeArgs, inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
A string representation of this object. [...]
inherited
when<TResult extends Object?>(TResult $default(T result), {required TResult failure(Failure error)}) → TResult
@optionalTypeArgs, inherited
whenOrNull<TResult extends Object?>(TResult $default(T result)?, {TResult failure(Failure error)?}) → TResult?
@optionalTypeArgs, inherited

Operators

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