maac_mvvm 0.2.2
maac_mvvm: ^0.2.2 copied to clipboard
maac_mvvm is a package supporting easy MVVM pattern implementation without any dependency injection wrapping, allowing freedom of choice.
maac_mvvm #
The core package of the MAAC ecosystem. It provides the base classes for the MVVM pattern and a lifecycle management system that mirrors the robustness of Android development.
🚀 Key Features #
- Lifecycle Synchronization: Android-inspired
onResume,onPause, andonDisposehooks. - Reactive State:
StreamDatafor clean data binding. - Efficient Rebuilds:
StreamDataConsumerfor granular UI updates.
📖 Usage #
1. Define your ViewModel #
class CounterViewModel extends ViewModel {
late final _counter = 0.mutableData(this);
late final counter = _counter.streamData;
void increment() => _counter.postValue(counter.data + 1);
}
2. Build your UI #
class CounterPage extends ViewModelWidget<CounterViewModel> {
@override
CounterViewModel createViewModel() => CounterViewModel();
@override
Widget build(BuildContext context, CounterViewModel viewModel) {
return Scaffold(
body: Center(
child: StreamDataConsumer<int>(
streamData: viewModel.counter,
builder: (context, data) => Text('$data'),
),
),
floatingActionButton: FloatingActionButton(
onPressed: viewModel.increment,
child: Icon(Icons.add),
),
);
}
}
🧭 Documentation #
For detailed API specifications, installation guides, and tutorials, please visit our centralized documentation hub:
Specific Guides: #
🤝 Contributing #
Contributions are welcome! Please visit the main repository for more information.