SintStatus<T> class
abstract
Algebraic data type for async operation states.
Inspired by Riverpod's AsyncValue — provides exhaustive pattern
matching via when and maybeWhen.
final status = SintStatus<User>.loading().obs;
// In widget:
Obx(() => controller.status.value.when(
loading: () => CircularProgressIndicator(),
success: (user) => Text(user.name),
error: (e) => Text('Error: $e'),
empty: () => Text('No data'),
));
- Mixed-in types
- Implementers
Constructors
- SintStatus()
-
const
- SintStatus.custom()
-
factory
- SintStatus.empty()
-
factory
- SintStatus.error(Object message)
-
factory
- SintStatus.loading()
-
factory
- SintStatus.success(T data)
-
factory
Properties
- dataOrNull → T?
-
Returns the data if isSuccess, otherwise
null.no setter - errorOrNull → Object?
-
Returns the error if isError, otherwise
null.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- isEmpty → bool
-
no setter
- isError → bool
-
no setter
- isLoading → bool
-
no setter
- isSuccess → bool
-
no setter
- props → List
-
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
maybeWhen<
R> ({R loading()?, R success(T data)?, R error(Object error)?, R empty()?, R custom()?, required R orElse()}) → R -
Partial pattern matching with a required
orElsefallback. -
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> ({required R loading(), required R success(T data), required R error(Object error), required R empty(), R custom()?}) → R - Exhaustive pattern matching — all cases must be handled.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited