ProductViewModel class

ViewModel for Product feature

Inheritance
Annotations

Constructors

ProductViewModel(ProductService _service)
Creates a new ProductViewModel instance

Properties

disposed bool
no setterinherited
errorMessage String?
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
initialized bool
no setterinherited
isBusy bool
Convenience getters for view states
no setterinherited
isEmpty bool
no setterinherited
isError bool
no setterinherited
isIdle bool
no setterinherited
isLoading bool
no setter
isSuccess bool
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
viewState ViewState
no setterinherited

Methods

addDisposable(ChangeNotifier disposable) → void
Adds a disposable resource to be disposed when the ViewModel is disposed
inherited
addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
addRxValue(RxValue rxValue) → void
Adds an RxValue to the disposables list
inherited
addSubscription(StreamSubscription subscription) → void
Adds a stream subscription to be disposed when the ViewModel is disposed
inherited
dispose() → void
Discards any resources used by the object. After this is called, the object is not in a usable state and should be discarded (calls to addListener will throw after the object is disposed).
inherited
initialize() Future<void>
Internal initialization method - called by FusionView
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
onActionPressed() → void
Example action method
onClose() Future<void>
Called when the ViewModel is being disposed Override this to perform cleanup logic
inherited
onDependenciesReady() Future<void>
Called after dependencies are ready but before onReady Override this to perform dependency-based initialization
inherited
onInit() Future<void>
Called when the ViewModel is first created Override this to perform initialization logic
inherited
onReady() Future<void>
Called after the view is ready and displayed to the user Override this to perform final initialization (API calls, etc.)
override
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
runBusyFuture<T>(Future<T> future, {String? busyMessage, String? successMessage, String? errorMessage(Object error)?}) Future<T?>
Executes a future and manages the view state automatically
inherited
setBusy([String? message]) → void
Sets the view state to busy (loading)
inherited
setEmpty([String? message]) → void
Sets the view state to empty
inherited
setError(String message) → void
Sets the view state to error with an optional error message
inherited
setIdle() → void
Sets the view state to idle and clears any error message
inherited
setSuccess([String? message]) → void
Sets the view state to success and clears any error message
inherited
toString() String
A string representation of this object.
inherited

Operators

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