Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”.

preface

This is a core part of Flutter development, starting with the preparation of Flutter state management, which is expected to be written many times. Statistics, more than 2 months, a total of 50 state management articles. This article to these state management articles for a summary, convenient when you need to find the corresponding article directly from this article. Welcome to comment area exchange, in order to save time not lost, strongly suggest collection!

Basic Principles

The basic chapter mainly introduces some background knowledge and implementation mechanism of state management, and the specific chapters are as follows:

  • Introduction to Flutter: Stateful and stateless components from a blind date perspective
  • Introduction to Flutter: Detailed explanation of the Flutter rendering mode
  • Introduction and Practice of Flutter (40) : State management of A Shopping cart as an example
  • Learn more about State management with InheritedWidgets
  • Learn more about State management from inheritedWidgets
  • Introduction to Flutter vs. Actual Flutter (xXIII) : setState vs. ModelBinding usage
  • What happened when analyzing setState from source code?
  • Introduction to Flutter and Practice (45) : a swastika! Learn about the InheritedWidget local refresh mechanism

The Provider series

Provider is officially recommended and one of the most popular state management plug-ins, and uses InheritedWidget to share state management in the component tree. The relevant chapters are as follows:

  • Use Provider to change the same code as 💩, reduce the code load by 2/3!
  • Using MultiProvider to manage multiple states simultaneously
  • Can providers implement nested state management?
  • Introduction to Flutter (50) : Providers implement irrelevant page state sharing
  • Introduction to Flutter (53) : learn about FutureProvider state management
  • Introduction to Flutter (54) : Local changes in the monitoring state of a Provider
  • Introduction to Flutter (55) : Play WebSocket with a Provider
  • Introduction to The Flutter: Let the simulator talk to the Postman
  • Introduction to Flutter and Practice (57) : Two simulators to chat — Provider integrated application

Redux series

Redux is essentially a Redux library of the front-endflutter_reduxPlugin, borrowed from Redux (see figure below).With Redux, you can achieve a complete separation of business logic and interface, with lower coupling. Articles in the Redux series are as follows:

  • How does a Flutter share React Redux state management
  • Introduction to Flutter (59) : A hand-held guide to asynchronous state management using Redux’s middleware
  • Introduction to Flutter (60) : How does the state of Redux share multiple components with a shopping list
  • Introduction to Flutter: Redux uses middleware to store shopping lists offline
  • Introduction to Flutter: Develop a general purpose addition and subtraction component for shopping carts
  • Introduction to Flutter and Practice (63) : Redux uses Distinct attributes to optimize performance
  • This article is very long. For performance, you have to bear with it — read the source code for the Flutter_redux accurate refresh

MobX

MobX also comes from the Responsive state management library on the Web side, which is very popular on the JS side (over 24K Star on Github). React dispatches the Action to update the state object. The view is then refreshed as the listener of the state object.A big advantage of MobX is the code generator, where status objects and update actions can be annotated to simplify code writing. With dependency injection containers (such as GetIt), state objects can be shared across multiple pages. Here’s the MobX chapter:

  • I have heard that MobX is very popular. Come to learn about Flutter?
  • How to make the code speed fly!
  • MobX gets web data to render cool curves with Flutter
  • Introduction to Flutter: How does MobX implement multi-component state sharing?
  • Introduction to Flutter (70) : MobX’s responsive Refresh mechanism from source Code.

GetX

GetX is one of the most popular state management plug-ins. Because of its rich functionality (not only state management), its easy-to-use interface makes many developers use it as a state management tool for their projects. We wrote a bit too much about GetX, as follows:

  • Getting Started with Flutter (71) : GetX — a Treasure chest for Flutter development
  • GetX manages the state of Flutter from entry to ecstasy
  • The introduction and Practice of Flutter (73) : The PK between GetX and Provider is reproduced on Digg’s personal homepage
  • Introduction to Flutter: Detailed explanation of the lifecycle of GetxController
  • Get started with Flutter: Simulate a traffic light to see GetX’s directional refresh
  • Introduction to Flutter: An introduction to GetX Responsive State Management
  • This Mid-Autumn Festival, island code painting poems will bring you to feel the romantic moonlight night on the beach
  • Why does the prize draw always draw a lonely Flutter
  • Hold on, don’t Flutter! How does the GetX Worker handle the shock
  • Getting started with Flutter (80) : Use GetX to build more elegant page structures
  • Just cut if you want to! How can dependency injection be used to quickly switch between Mock data and a real interface
  • GetX: How to use Flutter state management
  • Does GetX really smell that good?

BLoC

BLoC stands for Business Logic Component, which translates as Business Logic unit. From the name we know that the main business is aggregation. BLoX is based onStreamIn fact, the whole idea and other responsive check is not much, are divided into status update action, status object, and notification state dependent interface refresh. It is worth mentioning that,flutter_blocIs directly reused inProviderA large number of code, use andProviderSimilarly, so are the originators of the projectProviderIs a major contributor.An important factor in BLoC’s popularity is that its concept is more conducive to designing sound application architectures, as shown in the following article on BLoC:

  • Introduction to The Flutter (85) : GitHub’s highly praised BLoC Introduction
  • Start with Flutter: Less than 40 lines of code, hand jerk a BlocProvider
  • Are you The Provider’s long lost brother?
  • The Bloc Interface builder is a flexible and easy-to-use tool for building the Bloc interface
  • Introduction to Flutter: Use BlocListener to handle state changes
  • Get Started with Flutter (90) : Build responsive components and listen to state simultaneously using BlocConsumer
  • Get started with Flutter: Use RepositoryProvider to simplify the transfer of values to parent and child components

conclusion

As can be seen from the number of state management plug-ins for Flutter, more and more developers are participating in the open source community of Flutter, contributing many high-quality plug-ins. This is a good thing, but also a sweet annoyance — how to choose from so many state management plug-ins? In the next article we will do a cross-sectional comparison of some of the more popular plug-ins for Flutter through data analysis.

I am dao Code Farmer with the same name as my wechat official account. This is a column about the introduction and practice of Flutter, providing systematic learning articles about Flutter. See the corresponding source code here: The source code of Flutter Introduction and Practical column. If you have any questions, please add me to the wechat account: island-coder.

👍🏻 : feel the harvest please point a praise to encourage!

🌟 : Collect articles, easy to look back!

💬 : Comment exchange, mutual progress!