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)
-
constfactory
- Result.success(T value)
-
constfactory
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, thetoStringmethod will be overridden to output this instance'sprops.no setterinherited
Methods
-
fold<
R extends Object?> ({required R success(Success< T> success), required R failure(Failure failure)}) → R -
Available on Result<
The fold method is the equivalent to pattern matching. Its prototype depends on the _ResultT> , provided by the PatternMatching extension_types defined. -
foldOrElse<
R extends Object> ({R success(Success< T> success)?, R failure(Failure failure)?, required R orElse(Result<T> )}) → R -
Available on Result<
The foldOrElse method is equivalent to fold, but doesn't require all callbacks to be specified.T> , provided by the PatternMatching extension -
foldOrNull<
R extends Object?> ({R success(Success< T> success)?, R failure(Failure failure)?}) → R? -
Available on Result<
The foldOrNull method is equivalent to whenOrElse, but non-exhaustive.T> , provided by the PatternMatching extension -
getDataOrNull(
) → T? -
Available on Result<
Returns the encapsulated value if this instance represents success or null of it is failure.T> , provided by the PatternMatching extension -
getErrorOrNull(
) → VideoError? -
Available on Result<
T> , provided by the PatternMatching extension -
map<
R> (R convert(T data)) → Result< R> -
Available on Result<
The map method is the equivalent to pattern matching. Its prototype depends on the _ResultT> , provided by the PatternMatching extension_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<
The when method is the equivalent to pattern matching. Its prototype depends on the _ResultT> , provided by the PatternMatching extension_types defined. -
whenOrElse<
R extends Object> ({R success(T data)?, R failure(VideoError error)?, required R orElse(Result< T> )}) → R -
Available on Result<
The whenOrElse method is equivalent to when, but doesn't require all callbacks to be specified.T> , provided by the PatternMatching extension -
whenOrNull<
R extends Object?> ({R success(T data)?, R failure(VideoError error)?}) → R? -
Available on Result<
The whenOrNull method is equivalent to whenOrElse, but non-exhaustive.T> , provided by the PatternMatching extension
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited