MinNotifier class abstract
A robust, lightweight base class for reactive state management that extends ChangeNotifier.
MinNotifier retains all native features, properties, and contract behaviors of Flutter's
standard ChangeNotifier, but elevates the developer experience by introducing built-in
lifecycle hooks (onInit, onReady) and dynamic mutation utilities (update).
This structure is specifically designed to keep your presentation layer (Views/Pages) entirely Stateless, encapsulating asynchronous setup operations, side-effects, and initial data fetching cleanly within the controller layer. (Controller, ViewModel etc)
Example usage:
class HomeViewModel extends MinNotifier {
final UserService _service = UserService();
final User user = User();
bool isLoading = true;
@override
void onInit() {
// Triggers instantly on creation. Ideal for immediate data fetching
// without ever needing a StatefulWidget's initState on the page.
fetchUserData();
}
Future<void> fetchUserData() async {
final data = await _service.getProfile();
user = data;
isLoading = false;
notifyListeners();
}
}
- Inheritance
-
- Object
- ChangeNotifier
- MinNotifier
- Available extensions
Constructors
- MinNotifier()
- Initializes internal structures for subclasses of MinNotifier.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- isDisposed → bool
-
Returns whether this controller has already been disposed of by the framework.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
dispose(
) → void -
Discards any resources used by the object.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
override
-
onInit(
) → void - Triggered automatically as soon as this controller instance is instantiated in memory.
-
onReady(
) → void - Triggered immediately after the screen draws its very first frame.
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
tag(
String tag) → TaggedNotifier< T> -
Available on T, provided by the TaggedNotifierExtension extension
Assigns a tag to a notifier instance and converts it to aTaggedNotifier. -
toString(
) → String -
A string representation of this object.
inherited
-
update<
T> (T target, void action(T)) → void -
Safely mutates internal properties of a complex or mutable
targetobject and automatically triggers a UI notification to the widget tree.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited