pmvvm
4.0.1, released 5 years ago by an unverified publisher
A clean MVVM state management solution for Flutter using the Provider package and hooks.
What it does
PMVVM separates the UI (View) from state and business logic (ViewModel and Model). It uses the Provider package underneath to manage reactivity and provides built-in lifecycle methods inside ViewModels.
AI-written summary of version 4.0.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want an MVVM architecture without the heavy boilerplate of other state management libraries.
- Your widget has its own events that mutate state directly (e.g., pages, posts).
Skip it when
- You prefer pure BLoC, Riverpod, or Redux architectures for your entire application.
- You do not want to use the Provider package.
Strengths
- Simple and clean API with low boilerplate.
- Allows direct access to the BuildContext inside ViewModels.
- Supports observables for fine-grained reactivity and history tracking.
Weaknesses
- Relies heavily on the Provider package ecosystem.
- May require adapting to its specific View and ViewModel structure.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 3
class MyViewModel extends ViewModel {
int counter = 0;
void increase() {
counter++;
notifyListeners();
}
}
class MyWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MVVM<MyViewModel>(
view: () => _MyView(),
viewModel: MyViewModel(),
);
}
}Alternatives
Packages that do the same job and could replace pmvvm.
- flutter_bloc
If you prefer event-driven state management using BLoC/Cubit patterns.
86Compare - flutter_riverpod
If you want compile-safe global state management without BuildContext dependency.
93Compare
Works with
Packages commonly used together with pmvvm: ones it builds on, ones built on it, and its own family.