Result<T> class

A result is a class that represents the result of a command. It contains the data, success, loading, and error states. It is used to notify the widget when the state changes.

The T is the type of the data.

The data property is the data of the result. The isSuccess property is a boolean that indicates if the result is successful. The isLoading property is a boolean that indicates if the result is loading. The error property is the error of the result.

Constructors

Result({required T? data, required bool isSuccess, required bool isLoading, String? error})
Result.empty()
factory
Result.error(String error)
factory
Result.loading([T? data])
factory
Result.success(T data)
factory

Properties

data → T?
The data of the result.
final
error → String?
The error of the result.
final
hashCode → int
The hash code for this object.
no setteroverride
isLoading → bool
A boolean that indicates if the result is loading.
final
isSuccess → bool
A boolean that indicates if the result is successful.
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

Operators

operator ==(Object other) → bool
The equality operator.
override