Result<T> class
abstract
This class can be used as a general return type that carrying data, exception and message.
Constructors
- Result.cancelled({T? data, String? message})
-
factory
- Result.failure({T? data, Exception? exception, String? message})
-
factory
- Result.success({T? data})
-
factory
Properties
- data → T
-
no setter
- dataOrNull → T?
-
no setter
- exceptionOrNull → Exception?
-
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- messageOrNull → String?
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
transform<
R> ({R whenSuccess(Success< T> success)?, R whenFailure(Failure<T> failure)?, R whenCancelled(Cancelled<T> cancelled)?, required R whenElse(Result<T> result)}) → R -
transformNullable<
R> ({R whenSuccess(Success< T> success)?, R whenFailure(Failure<T> failure)?, R whenCancelled(Cancelled<T> cancelled)?, R whenElse(Result<T> result)?}) → R? -
use(
{void whenSuccess(Success< T> success)?, void whenFailure(Failure<T> failure)?, void whenCancelled(Cancelled<T> cancelled)?, void whenElse(Result<T> result)?}) → void
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited