Closed dustincatap closed 1 year ago
The blueprint currently uses MVVM as its state management. It uses ValueListenable combined with ValueListenableBuilder which are available out-of-the-box in Flutter.
ValueListenable
ValueListenableBuilder
class HomeViewModel { final ValueNotifier<int> _count = ValueNotifier(0); ValueListenable<int> get count => _count; void increment() => _count.value++; } class HomeView extends StatelessWidget { final HomeViewModel _viewModel = HomeViewModel(); const HomeView({super.key}); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: const Text('Home')), body: ValueListenableBuilder<int>( valueListenable: _viewModel.count, builder: (context, count, child) { return Text('Count value: $count'); }, ), floatingActionButton: FloatingActionButton( onPressed: _viewModel.increment, child: const Icon(Icons.add), ), ); } }
These classes are simple and good enough to be used instead of adding 3rd party plugins.
It is known fact that Flutter has multiple state management options. Eventually, as a developer, you will be asking "Which am I going to use"?
TODO
No response
Closing this. Will stick to the current state management of the project.
Explain in 1-2 sentences. Say what this is about.
The blueprint currently uses MVVM as its state management. It uses
ValueListenable
combined withValueListenableBuilder
which are available out-of-the-box in Flutter.These classes are simple and good enough to be used instead of adding 3rd party plugins.
Motivation Goals
It is known fact that Flutter has multiple state management options. Eventually, as a developer, you will be asking "Which am I going to use"?
ValueListenable
andValueListenableBuilder
are already part of the core Flutter package.In scope
TODO
Out of scope
TODO
Risks / unknowns
TODO
Examples
No response