VerificationResult<T> class
A wrapper class for operation results that can either succeed or fail
This provides a type-safe way to handle operations that might fail without using exceptions for control flow.
Example:
final result = await someOperation();
if (result.isSuccess) {
print('Success: ${result.data}');
} else {
print('Error: ${result.error?.message}');
}
Constructors
- VerificationResult.failure(GetVerifiedException error)
-
Creates a failed result with an error
factory
- VerificationResult.success(T data)
-
Creates a successful result with data
factory
Properties
- data → T?
-
The successful result data (null if failed)
final
- error → GetVerifiedException?
-
The error that occurred (null if successful)
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isFailure → bool
-
Whether the operation failed
no setter
- isSuccess → bool
-
Whether the operation was successful
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
flatMap<
R> (Future< VerificationResult< transform(T data)) → Future<R> >VerificationResult< R> > - Chains another operation that returns a VerificationResult
-
fold<
R> ({required R onSuccess(T data), required R onFailure(GetVerifiedException error)}) → R -
Executes
onSuccessif successful,onFailureif failed -
map<
R> (R transform(T data)) → VerificationResult< R> - Maps the success value to a new type
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited