Book Image

Managing State in Flutter Pragmatically

By : RAHUL AGARWAL, Waleed Arshad
Book Image

Managing State in Flutter Pragmatically

By: RAHUL AGARWAL, Waleed Arshad

Overview of this book

Flutter is a cross-platform user interface (UI) toolkit that enables developers to create beautiful native applications for mobile, desktop, and the web with a single codebase. State management in Flutter is one of the most crucial and complex topics within Flutter, with a wide array of approaches available that can make it easy to get lost due to information overload. Managing State in Flutter Pragmatically is a definitive guide to starting out with Flutter and learning about state management, helping developers with some experience of state management to choose the most appropriate solutions and techniques to use. The book takes a hands-on approach and begins by covering the basics of Flutter state management before exploring how to build and manipulate a shopping cart app using popular approaches such as BLoC/Cubit, Provider, MobX, and Riverpod. Throughout the book, you'll also learn how to adopt approaches from React such as Redux and all its types. By the end of this Flutter book, you'll have gained a holistic view of all the state management approaches in Flutter, and learned which approach is the best solution for managing state in your app development journey.
Table of Contents (14 chapters)
1
Section 1:The Basics of State Management
4
Section 2:Types, Techniques, and Approaches
8
Section 3:Code-Level Implementation

What this book covers

Chapter 1, States and State Management Overview, covers all the basic understanding of state in Flutter, how it affects our application, how it affects our approach to writing code, and how changes in state affect the application in general.

Chapter 2, The Core Building Blocks of State Management, takes a deep dive into the implementations of the core building blocks of state management approaches, starting from setState(), which is the first approach and the default implemented technique when a new Flutter application is created, followed by InheritedWidget and InheritedModel, which are helpful when the scope of the application is expanded.

Chapter 3, Diving into Advanced State Management Approaches, describes in detail the intermediate-advanced level of approaches used in the larger part of the Flutter application development world, starting with BLoC and Cubit, driving down to Provider and its refactored implementation, Riverpod.

Chapter 4, Adopting State Management Approaches from React, takes a look at the approaches in Flutter that are from React. This includes the famous Redux approach and its flavors, Fish-Redux and MobX.

Chapter 5, Executing Distinctive Approaches like GetX, GetIt, and Binder, discusses the approaches that most people use for their convenience and code style. We will discuss the theory and concepts behind GetX, GetIt, and Binder.

Chapter 6, Creating a Shopping Cart Application Using Basic Approaches, describes how to code a shopping cart application using basic approaches.

Chapter 7, Manipulating a Shopping Cart Application through BLoC, Provider, and React-Based Approaches, takes a deep dive into Provider and React-based approaches. This chapter describes how to code the shopping cart app using some famous approaches.

Chapter 8, Using GetX, GetIt, and Binder to Update the Cart Application, describes how to code shopping cart example applications using some specific, simplified approaches.

Chapter 9, Comparative State Management Analysis: When to Use What?, gives you a clear insight into when to use what. This chapter briefly describes all the techniques discussed in the previous chapters and presents a comparative analysis to help you decide what technique should be used in what sort of situation.