PrismViewState<T> class
sealed
A sealed view-state that drives PrismStateView rendering.
Dart 3 exhaustive switching means the compiler forces you to handle every state — no more forgotten error branches:
final state = switch (fetch()) {
PrismViewLoading() => const CircularProgressIndicator(),
PrismViewError(:final error) => Text('Failed: $error'),
PrismViewEmpty() => const Text('Nothing here yet'),
PrismViewSuccess(:final data) => Text(data),
};
- Implementers
Constructors
- PrismViewState.empty()
-
The operation succeeded but produced no data (e.g. an empty list).
constfactory
- PrismViewState.error([Object? error, StackTrace? stackTrace])
-
Something went wrong. Carries the
errorand optionalstackTrace.constfactory - PrismViewState.loading({String? message})
-
Something is in progress.
constfactory
- PrismViewState.success(T data)
-
The operation succeeded and produced
data.constfactory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- 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.
inherited