Result<T> class abstract

A class which encapsulates a successful outcome with a value of type T or a failure with VideoError.

Available extensions

Constructors

Result.error(String message, [StackTrace? stackTrace])
factory
Result.errorWithCause(String message, Object cause, [StackTrace? stackTrace])
factory
Result.failure(VideoError error)
const
factory
Result.success(T value)
const
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
isFailure bool
Check if the result is a Failure.
no setter
isSuccess bool
Checks if the result is a Success.
no setter
props List<Object?>
The list of properties that will be used to determine whether two instances are equal.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stringify bool?
If set to true, the toString method will be overridden to output this instance's props.
no setterinherited

Methods

fold<R extends Object?>({required R success(Success<T> success), required R failure(Failure failure)}) → R

Available on Result<T>, provided by the PatternMatching extension

The fold method is the equivalent to pattern matching. Its prototype depends on the _Result _types defined.
foldOrElse<R extends Object>({R success(Success<T> success)?, R failure(Failure failure)?, required R orElse(Result<T>)}) → R

Available on Result<T>, provided by the PatternMatching extension

The foldOrElse method is equivalent to fold, but doesn't require all callbacks to be specified.
foldOrNull<R extends Object?>({R success(Success<T> success)?, R failure(Failure failure)?}) → R?

Available on Result<T>, provided by the PatternMatching extension

The foldOrNull method is equivalent to whenOrElse, but non-exhaustive.
getDataOrNull() → T?

Available on Result<T>, provided by the PatternMatching extension

Returns the encapsulated value if this instance represents success or null of it is failure.
getErrorOrNull() → VideoError?

Available on Result<T>, provided by the PatternMatching extension

map<R>(R convert(T data)) Result<R>

Available on Result<T>, provided by the PatternMatching extension

The map method is the equivalent to pattern matching. Its prototype depends on the _Result _types defined.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
when<R extends Object?>({required R success(T data), required R failure(VideoError error)}) → R

Available on Result<T>, provided by the PatternMatching extension

The when method is the equivalent to pattern matching. Its prototype depends on the _Result _types defined.
whenOrElse<R extends Object>({R success(T data)?, R failure(VideoError error)?, required R orElse(Result<T>)}) → R

Available on Result<T>, provided by the PatternMatching extension

The whenOrElse method is equivalent to when, but doesn't require all callbacks to be specified.
whenOrNull<R extends Object?>({R success(T data)?, R failure(VideoError error)?}) → R?

Available on Result<T>, provided by the PatternMatching extension

The whenOrNull method is equivalent to whenOrElse, but non-exhaustive.

Operators

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