Skip to content

Commit 073821f

Browse files
authored
Link to topic on pub.dev for state management packages (#12368)
Rather than trying to maintain a list of state management packages and their relevant resources, or just accepting whichever is contributed as we've historically done, let's just link to a pub.dev topic instead. This PR updates the state-management approaches page to: - Group the built-in, low-level solutions under a own header. - Remove each of the listed third-party packages. - Add a new section about community-provided packages. - Briefly introduces why you might want to use one. - Highlights the options are provided by the community. - Clarifies there is no right choice, but it depends on each app and team's needs. - Links to the `#state-management` topic on pub.dev. - Links again to the topic with a prominent link card. - Offers a suggestion to add to the list and links to the relevant documentation on dart.dev. --- **Staged:** https://flutter-docs-prod--pr12368-feat-12252-uy54axns.web.app/data-and-backend/state-mgmt/options#community-provided-packages Resolves #12252
1 parent 579ed31 commit 073821f

File tree

2 files changed

+59
-271
lines changed

2 files changed

+59
-271
lines changed

src/content/codelabs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ one of the following codelabs:
5151
[Records and Patterns in Dart 3]: {{site.codelabs}}/codelabs/dart-patterns-records
5252
[Dart null safety in Action]: {{site.yt.watch}}?v=HdKwuHQvArY
5353
[inherited-widget-ws]: {{site.yt.watch}}?v=LFcGPS6cGrY
54-
[low-level state management]: /data-and-backend/state-mgmt/options#inheritedwidget-inheritedmodel
54+
[low-level state management]: /data-and-backend/state-mgmt/options#inheritedwidget-and-inheritedmodel
5555

5656
## Designing a Flutter UI
5757

Lines changed: 58 additions & 270 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
---
2-
title: List of state management approaches
3-
description: A list of different approaches to managing state.
2+
title: Approaches to state management
3+
short-link: State-management approaches
4+
breadcrumb: Approaches
5+
description: >-
6+
An introduction to different approaches to
7+
managing state in Flutter apps.
48
prev:
59
title: Simple app state management
610
path: /data-and-backend/state-mgmt/simple
@@ -11,8 +15,8 @@ If you feel that some of your questions haven't been answered,
1115
or that the approach described on these pages
1216
is not viable for your use cases, you are probably right.
1317

14-
Learn more at the following links,
15-
many of which have been contributed by the Flutter community:
18+
Learn more from the following resources,
19+
many of which have been contributed by the Flutter community.
1620

1721
## General overview
1822

@@ -30,26 +34,9 @@ Things to review before selecting an approach.
3034
[Introduction to state management]: /data-and-backend/state-mgmt/intro
3135
[Pragmatic State Management in Flutter]: {{site.yt.watch}}?v=d_m5csmrf7I
3236

33-
## Provider
37+
## Built-in approaches
3438

35-
* [Simple app state management][], the previous page in this section
36-
* [Provider package][]
37-
38-
[Provider package]: {{site.pub-pkg}}/provider
39-
[Simple app state management]: /data-and-backend/state-mgmt/simple
40-
41-
## Riverpod
42-
43-
Riverpod works in a similar fashion to Provider.
44-
It offers compile safety and testing without depending on the Flutter SDK.
45-
46-
* [Riverpod][] homepage
47-
* [Getting started with Riverpod][]
48-
49-
[Getting started with Riverpod]: https://riverpod.dev/docs/introduction/getting_started
50-
[Riverpod]: https://riverpod.dev/
51-
52-
## setState
39+
### `setState`
5340

5441
The low-level approach to use for widget-specific, ephemeral state.
5542

@@ -59,20 +46,24 @@ The low-level approach to use for widget-specific, ephemeral state.
5946
[Adding interactivity to your Flutter app]: /ui/interactivity
6047
[Basic state management in Google Flutter]: {{site.medium}}/@agungsurya/basic-state-management-in-google-flutter-6ee73608f96d
6148

62-
## ValueNotifier & InheritedNotifier
49+
<a id="valuenotifier-inheritednotifier" aria-hidden="true"></a>
6350

64-
An approach using only Flutter provided tooling to update state and notify the UI of changes.
51+
### `ValueNotifier` and `InheritedNotifier`
6552

53+
An approach using only Flutter provided APIs to
54+
update state and notify the UI of changes.
6655

6756
* [State Management using ValueNotifier and InheritedNotifier][], by Tadas Petra
6857

6958
[State Management using ValueNotifier and InheritedNotifier]: https://www.hungrimind.com/articles/flutter-state-management
7059

71-
## InheritedWidget &amp; InheritedModel
60+
<a id="inheritedwidget-inheritedmodel" aria-hidden="true"></a>
61+
62+
### `InheritedWidget` and `InheritedModel`
7263

73-
The low-level approach used to communicate between ancestors and children
74-
in the widget tree. This is what `provider` and many other approaches
75-
use under the hood.
64+
The low-level approach used to
65+
communicate between ancestors and children in the widget tree.
66+
This is what `package:provider` and many other approaches use under the hood.
7667

7768
The following instructor-led video workshop covers how to
7869
use `InheritedWidget`:
@@ -94,246 +85,43 @@ Other useful docs include:
9485
[Using Flutter Inherited Widgets Effectively]: https://ericwindmill.com/articles/inherited_widget/
9586
[Widget - State - Context - InheritedWidget]: https://www.didierboelens.com/2018/06/widget---state---context---inheritedwidget/
9687

97-
## June
98-
99-
A lightweight and modern state management library that focuses on providing
100-
a pattern similar to Flutter's built-in state management.
101-
102-
* [june package][]
103-
104-
[june package]: {{site.pub-pkg}}/june
105-
106-
107-
## Redux
108-
109-
A state container approach familiar to many web developers.
110-
111-
* [Animation Management with Redux and Flutter][],
112-
a video from DartConf 2018 [Accompanying article on Medium][]
113-
* [Flutter Redux package][]
114-
* [Redux Saga Middleware Dart and Flutter][], by Bilal Uslu
115-
* [Introduction to Redux in Flutter][], by Xavi Rigau
116-
* [Flutter + Redux&mdash;How to make a shopping list app][],
117-
by Paulina Szklarska on Hackernoon
118-
* [Building a TODO application (CRUD) in Flutter with Redux&mdash;Part 1][],
119-
a video by Tensor Programming
120-
* [Flutter Redux Thunk, an example][], by Jack Wong
121-
* [Building a (large) Flutter app with Redux][], by Hillel Coren
122-
* [Fish-Redux–An assembled flutter application framework based on Redux][],
123-
by Alibaba
124-
* [Async Redux–Redux without boilerplate. Allows for both sync and async reducers][],
125-
by Marcelo Glasberg
126-
* [Flutter meets Redux: The Redux way of managing Flutter applications state][],
127-
by Amir Ghezelbash
128-
* [Redux and epics for better-organized code in Flutter apps][], by Nihad Delic
129-
* [Flutter_Redux_Gen - VS Code Plugin to generate boiler plate code][], by Balamurugan Muthusamy (BalaDhruv)
130-
* [Flutter Animations Studio][], by Gianluca Romeo
131-
132-
[Accompanying article on Medium]: {{site.flutter-medium}}/animation-management-with-flutter-and-flux-redux-94729e6585fa
133-
[Animation Management with Redux and Flutter]: {{site.yt.watch}}?v=9ZkLtr0Fbgk
134-
[Async Redux–Redux without boilerplate. Allows for both sync and async reducers]: {{site.pub}}/packages/async_redux
135-
[Building a (large) Flutter app with Redux]: https://hillelcoren.com/2018/06/01/building-a-large-flutter-app-with-redux/
136-
[Building a TODO application (CRUD) in Flutter with Redux&mdash;Part 1]: {{site.yt.watch}}?v=Wj216eSBBWs
137-
[Fish-Redux–An assembled flutter application framework based on Redux]: {{site.github}}/alibaba/fish-redux/
138-
[Flutter Redux Thunk, an example]: {{site.medium}}/flutterpub/flutter-redux-thunk-27c2f2b80a3b
139-
[Flutter meets Redux: The Redux way of managing Flutter applications state]: {{site.medium}}/@thisisamir98/flutter-meets-redux-the-redux-way-of-managing-flutter-applications-state-f60ef693b509
140-
[Flutter Redux package]: {{site.pub-pkg}}/flutter_redux
141-
[Flutter + Redux&mdash;How to make a shopping list app]: https://hackernoon.com/flutter-redux-how-to-make-shopping-list-app-1cd315e79b65
142-
[Introduction to Redux in Flutter]: https://blog.novoda.com/introduction-to-redux-in-flutter/
143-
[Redux and epics for better-organized code in Flutter apps]: {{site.medium}}/upday-devs/reduce-duplication-achieve-flexibility-means-success-for-the-flutter-app-e5e432839e61
144-
[Redux Saga Middleware Dart and Flutter]: {{site.pub-pkg}}/redux_saga
145-
[Flutter_Redux_Gen - VS Code Plugin to generate boiler plate code]: https://marketplace.visualstudio.com/items?itemName=BalaDhruv.flutter-redux-gen
146-
[Flutter Animations Studio]: {{site.github}}/gianlucaromeo/flutter-animations-studio
147-
148-
## Fish-Redux
149-
150-
Fish Redux is an assembled flutter application framework
151-
based on Redux state management.
152-
It is suitable for building medium and large applications.
153-
154-
* [Fish-Redux-Library][] package, by Alibaba
155-
* [Fish-Redux-Source][], project code
156-
* [Flutter-Movie][], A non-trivial example demonstrating how
157-
to use Fish Redux, with more than 30 screens, graphql,
158-
payment api, and media player.
159-
160-
[Fish-Redux-Library]: {{site.pub-pkg}}/fish_redux
161-
[Fish-Redux-Source]: {{site.github}}/alibaba/fish-redux
162-
[Flutter-Movie]: {{site.github}}/o1298098/Flutter-Movie
163-
164-
## BLoC / Rx
165-
166-
A family of stream/observable based patterns.
167-
168-
* [Architect your Flutter project using BLoC pattern][],
169-
by Sagar Suri
170-
* [BloC Library][], by Felix Angelov
171-
* [Reactive Programming - Streams - BLoC - Practical Use Cases][],
172-
by Didier Boelens
173-
174-
[Architect your Flutter project using BLoC pattern]: {{site.medium}}/flutterpub/architecting-your-flutter-project-bd04e144a8f1
175-
[BloC Library]: https://felangel.github.io/bloc
176-
[Reactive Programming - Streams - BLoC - Practical Use Cases]: https://www.didierboelens.com/2018/12/reactive-programming---streams---bloc---practical-use-cases
177-
178-
## GetIt
179-
180-
A service locator based state management approach that
181-
doesn't need a `BuildContext`.
182-
183-
* [GetIt package][], the service locator.
184-
It can also be used together with BloCs.
185-
* [GetIt Mixin package][], a mixin that completes
186-
`GetIt` to a full state management solution.
187-
* [GetIt Hooks package][], same as the mixin in
188-
case you already use `flutter_hooks`.
189-
* [Flutter state management for minimalists][], by Suragch
190-
191-
:::note
192-
To learn more, watch this short Package of the Week video on the GetIt package:
193-
194-
{% ytEmbed 'f9XQD5mf6FY', 'get_it | Flutter package of the week' %}
88+
## Community-provided packages
89+
90+
Depending on the complexity of your app and preferences of your team,
91+
you might find adopting a state management package useful.
92+
State management packages often help reduce boilerplate code,
93+
provide specialized debugging tools, and can help
94+
enable a clearer and consistent application architecture.
95+
96+
The Flutter community offers a wide variety of state management packages.
97+
The best choice for your app often depends on the app's complexity,
98+
your team's preferences, and the specific problems you need to solve.
99+
100+
To begin exploring the available options,
101+
check out the [`#state-management`][]{: target="_blank"} topic on the pub.dev site and
102+
refine the search to find packages that match your needs.
103+
104+
<div class="card-grid">
105+
<a class="card outlined-card" href="{{site.pub}}/packages?q=topic%3Astate-management" target="_blank">
106+
<div class="card-header">
107+
<span class="card-title">
108+
<span>State management packages</span>
109+
<span class="material-symbols" aria-hidden="true" style="font-size: 1rem;" translate="no">open_in_new</span>
110+
</span>
111+
</div>
112+
<div class="card-content">
113+
<p>Explore the variety of state-management packages built by and for the Flutter community.</p>
114+
</div>
115+
</a>
116+
</div>
117+
118+
:::tip
119+
If you've developed a state management package that
120+
you think would be useful to the Flutter community,
121+
consider [adding the `state-management` topic][pub-topics] and
122+
[publishing the package][pub-publish] to pub.dev.
195123
:::
196124

197-
[Flutter state management for minimalists]: {{site.medium}}/flutter-community/flutter-state-management-for-minimalists-4c71a2f2f0c1?sk=6f9cedfb550ca9cc7f88317e2e7055a0
198-
[GetIt package]: {{site.pub-pkg}}/get_it
199-
[GetIt Hooks package]: {{site.pub-pkg}}/get_it_hooks
200-
[GetIt Mixin package]: {{site.pub-pkg}}/get_it_mixin
201-
202-
## MobX
203-
204-
A popular library based on observables and reactions.
205-
206-
* [MobX.dart, Hassle free state-management for your Dart and Flutter apps][]
207-
* [Getting started with MobX.dart][]
208-
* [Flutter: State Management with Mobx][], a video by Paul Halliday
209-
210-
[Flutter: State Management with Mobx]: {{site.yt.watch}}?v=p-MUBLOEkCs
211-
[Getting started with MobX.dart]: https://mobx.netlify.app/getting-started
212-
[MobX.dart, Hassle free state-management for your Dart and Flutter apps]: {{site.github}}/mobxjs/mobx.dart
213-
214-
## Dart Board
215-
216-
A modular feature management framework for Flutter.
217-
Dart Board is designed to help encapsulate and isolate
218-
features, including examples/frameworks,
219-
small kernel, and many ready-to-use decoupled features
220-
such as debugging, logging, auth, redux, locator,
221-
particle system and more.
222-
223-
* [Dart Board Homepage + Demos](https://dart-board.io/)
224-
* [Dart Board on pub.dev]({{site.pub-pkg}}/dart_board_core)
225-
* [dart_board on GitHub]({{site.github}}/ahammer/dart_board)
226-
* [Getting started with Dart Board]({{site.github}}/ahammer/dart_board/blob/master/GETTING_STARTED.md)
227-
228-
## Flutter Commands
229-
230-
Reactive state management that uses the Command Pattern
231-
and is based on `ValueNotifiers`. Best in combination with
232-
[GetIt](#getit), but can be used with `Provider` or other
233-
locators too.
234-
235-
* [Flutter Command package][]
236-
* [RxCommand package][], `Stream` based implementation.
237-
238-
[Flutter Command package]: {{site.pub-pkg}}/flutter_command
239-
[RxCommand package]: {{site.pub-pkg}}/rx_command
240-
241-
## Binder
242-
243-
A state management package that uses `InheritedWidget`
244-
at its core. Inspired in part by recoil.
245-
This package promotes the separation of concerns.
246-
247-
* [Binder package][]
248-
* [Binder examples][]
249-
* [Binder snippets][], vscode snippets to be even more
250-
productive with Binder
251-
252-
[Binder examples]: {{site.github}}/letsar/binder/tree/main/examples
253-
[Binder package]: {{site.pub-pkg}}/binder
254-
[Binder snippets]: https://marketplace.visualstudio.com/items?itemName=romain-rastel.flutter-binder-snippets
255-
256-
## GetX
257-
258-
A simplified reactive state management solution.
259-
260-
* [GetX package][]
261-
* [GetX Flutter Firebase Auth Example][], by Jeff McMorris
262-
263-
[GetX package]: {{site.pub-pkg}}/get
264-
[GetX Flutter Firebase Auth Example]: {{site.medium}}/@jeffmcmorris/getx-flutter-firebase-auth-example-b383c1dd1de2
265-
266-
## states_rebuilder
267-
268-
An approach that combines state management with a
269-
dependency injection solution and an integrated router.
270-
For more information, see the following info:
271-
272-
* [States Rebuilder][] project code
273-
* [States Rebuilder documentation][]
274-
275-
[States Rebuilder]: {{site.github}}/GIfatahTH/states_rebuilder
276-
[States Rebuilder documentation]: {{site.github}}/GIfatahTH/states_rebuilder/wiki
277-
278-
## Triple Pattern (Segmented State Pattern)
279-
280-
Triple is a pattern for state management that uses `Streams` or `ValueNotifier`.
281-
This mechanism (nicknamed _triple_ because the stream always uses three
282-
values: `Error`, `Loading`, and `State`), is based on the
283-
[Segmented State pattern][].
284-
285-
For more information, refer to the following resources:
286-
287-
* [Triple documentation][]
288-
* [Flutter Triple package][]
289-
* [Triple Pattern: A new pattern for state management in Flutter][]
290-
(blog post written in Portuguese but can be auto-translated)
291-
* [VIDEO: Flutter Triple Pattern by Kevlin Ossada][] (recorded in English)
292-
293-
[Triple documentation]: https://triple.flutterando.com.br/
294-
[Flutter Triple package]: {{site.pub-pkg}}/flutter_triple
295-
[Segmented State pattern]: https://triple.flutterando.com.br/docs/intro/overview#-segmented-state-pattern-ssp
296-
[Triple Pattern: A new pattern for state management in Flutter]: https://blog.flutterando.com.br/triple-pattern-um-novo-padr%C3%A3o-para-ger%C3%AAncia-de-estado-no-flutter-2e693a0f4c3e
297-
[VIDEO: Flutter Triple Pattern by Kevlin Ossada]: {{site.yt.watch}}?v=dXc3tR15AoA
298-
299-
## solidart
300-
301-
A simple and performant fine-grained reactivity state management solution for building user interfaces.
302-
Enjoy the automatic reactivity system with Signal, Computed, Resource and Effect.
303-
304-
* [Official Documentation][]
305-
* [solidart package][]
306-
* [flutter_solidart package][]
307-
308-
[Official Documentation]: https://solidart.mariuti.com
309-
[solidart package]: {{site.pub-pkg}}/solidart
310-
[flutter_solidart package]: {{site.pub-pkg}}/flutter_solidart
311-
312-
## flutter_reactive_value
313-
314-
The `flutter_reactive_value` library might offer the least complex solution for state
315-
management in Flutter. It might help Flutter newcomers add reactivity to their UI,
316-
without the complexity of the mechanisms described before.
317-
The `flutter_reactive_value` library defines the `reactiveValue(BuildContext)`
318-
extension method on `ValueNotifier`. This extension allows a `Widget` to
319-
fetch the current value of the `ValueNotifier` and
320-
subscribe the `Widget` to changes in the value of the `ValueNotifier`.
321-
If the value of the `ValueNotifier` changes, `Widget` rebuilds.
322-
323-
* [`flutter_reactive_value`][] source and documentation
324-
325-
[`flutter_reactive_value`]: {{site.github}}/lukehutch/flutter_reactive_value
326-
327-
## Elementary
328-
329-
Elementary is a simple and reliable way to build applications with MVVM in Flutter.
330-
It offers a pure Flutter experience with clear code separation by responsibilities,
331-
efficient rebuilds, easy testability, and enhancing team productivity.
332-
333-
* [Elementary Documentation][]
334-
* [Elementary Repository][]
335-
* [Elementary package][]
336-
337-
[Elementary Documentation]: https://documentation.elementaryteam.dev/
338-
[Elementary Repository]: {{site.github}}/Elementary-team/flutter-elementary
339-
[Elementary package]: {{site.pub-pkg}}/elementary
125+
[`#state-management`]: {{site.pub}}/packages?q=topic%3Astate-management
126+
[pub-topics]: {{site.dart-site}}/tools/pub/pubspec#topics
127+
[pub-publish]: {{site.dart-site}}/tools/pub/publishing

0 commit comments

Comments
 (0)