provider
6.1.5+1, released a year ago by dash-overflow.net
A lightweight wrapper around InheritedWidget for state management
Flutter FavoriteWASM-ready
What it does
Provider exposes values via InheritedWidgets, simplifying resource allocation, lazy loading, and rebuilds. It offers convenient context extensions like watch, read, and select for consuming state.
AI-written summary of version 6.1.5+1, based on the package's README and metadata. Report an inaccuracy
Use it when
- Simple state management with ChangeNotifier or ValueNotifier
- Small to medium apps needing dependency injection
- When you want devtools visibility of provider state
Skip it when
- Large, complex state that benefits from advanced patterns like Riverpod or Bloc
- When you need code generation for models or forms
Strengths
- Simple API, minimal boilerplate
- Built‑in devtools integration
- Lazy loading and efficient rebuilds
Weaknesses
- No built‑in code generation
- Limited to InheritedWidget under the hood, may feel less modern than Riverpod
- Can become verbose for many providers
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 2
Provider(
create: (_) => MyModel(),
child: MyApp(),
);Alternatives
Packages that do the same job and could replace provider.
Works with
Packages commonly used together with provider: ones it builds on, ones built on it, and its own family.
- nestedprovider depends on itWidget that flattens deeply nested widget trees into a list of children.
- flutter_blocBuilt on providerFlutter widgets to easily integrate blocs and cubits for state management.
- chewieBuilt on providerVideo player widget with Material/Cupertino controls
- flutter_math_forkBuilt on providerFast and high-quality TeX math equation rendering with pure Dart and Flutter.
- flutter_chat_uiBuilt on providerA customizable, cross‑platform chat UI widget set for Flutter.
- flutter_map_marker_popupBuilt on providerMarker popups for flutter_map
- flutter_mobxBuilt on providerFlutter integration for MobX, providing reactive Observer widgets.
- responsive_builderBuilt on providerWidgets for responsive UI across device types and orientations