maac_mvvm 0.2.2 copy "maac_mvvm: ^0.2.2" to clipboard
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 #

pub package

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, and onDispose hooks.
  • Reactive State: StreamData for clean data binding.
  • Efficient Rebuilds: StreamDataConsumer for 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:

👉 MAAC Documentation Hub

Specific Guides: #


🤝 Contributing #

Contributions are welcome! Please visit the main repository for more information.

2
likes
160
points
131
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

maac_mvvm is a package supporting easy MVVM pattern implementation without any dependency injection wrapping, allowing freedom of choice.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

async, flutter, visibility_detector

More

Packages that depend on maac_mvvm