ResultState<T extends Object> class

Helper class that holds result of function execution

Can contain error, result, or null

Example:

ResultState.success(result: 'test');

Constructors

ResultState.check({Object? error, String? messageToDisplay})
Constructs result based on error value
factory
ResultState.error({required Object error, String? messageToDisplay})
Constructs invalid function result
factory
ResultState.success({T? result})
Constructs successful function result
factory

Properties

error Object?
Error to be returned from function as result of function execution
final
hashCode int
The hash code for this object.
no setterinherited
isSuccessful bool
Checks if error and messageToDisplay are null
no setter
messageToDisplay String?
Message to display if error is not null
final
result → T?
Successfull result of function execution
final
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
unwrapError<ErrorType extends Object>() → ErrorType
Returns error with given type or throws exception

Operators

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