states_rebuilder
6.4.0, released 3 years ago by an unverified publisher
A simple yet powerful state management technique for Flutter with zero boilerplate.
What it does
Provides an integrated approach to state management, dependency injection, and navigation using reactive state injection. Handles asynchronous status automatically and supports state persistence and undo/redo.
AI-written summary of version 6.4.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want state management with zero boilerplate and no code generation
- You need built-in dependency injection, routing, and state persistence
- You want simple handling of asynchronous futures and streams without manual tracking variables
Skip it when
- You prefer the explicit event-to-state mapping of BLoC
- You want to use Riverpod or Provider ecosystem instead
Strengths
- Zero boilerplate with no code generation required
- Comprehensive feature set including dependency injection, navigation, and persistence
- Built-in handling of asynchronous states (idle, waiting, error, data)
Weaknesses
- Less community adoption compared to Riverpod or Provider
- Relies on a proprietary global/functional injection approach which can be unconventional
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 4
Add states_rebuilder to dependencies in pubspec.yaml
class ViewModel {
final counter = 0.inj();
increment() => counter.state++;
}
final viewModel = ViewModel();
class CounterApp extends ReactiveStatelessWidget {
@override
Widget build(BuildContext context) {
return Text('Value: ${viewModel.counter.state}');
}
}Alternatives
Packages that do the same job and could replace states_rebuilder.
- riverpod
If you prefer a compile-safe, provider-based dependency and state management library.
99Compare - flutter_bloc
If you prefer strict event-driven architecture with predictable state transitions.
86Compare - provider
If you want a lightweight, standard InheritedWidget wrapper for state propagation.
81Compare
Works with
Packages commonly used together with states_rebuilder: ones it builds on, ones built on it, and its own family.
- multiselectBuilt on states_rebuilderA simple multiselect dropdown widget for Flutter.
- animatorBuilt on states_rebuilderA Flutter library for explicit, implicit, and staggered animations using the Animator and AnimateWidget.
- ids_material_sdkBuilt on states_rebuilderA Flutter SDK that bundles fast networking, secure API handling, and reusable Material UI widgets.