Skip to main content

Posts

Showing posts with the label State Management

Getting started with state management in Flutter (Part 2)

Getting started with state management in Flutter (Part 2) Introduction to the Provider package In part 1 of the introduction to state management, we introduced Flutter’s most basic constructs for state management. Using setState() and InheritedWidget 's gave us the ability to control how our application re-draws itself based on state changes in real time. In part 2, we will introduce the Provider package, adding another tool in our toolbox for managing state. Provider gives us "syntactic sugar" on top of the InheritedWidget and gives us an easy to use API that help us to remove the amount of boiler plate code that we have to write which is always a win. Referencing the Provider package in your Flutter application When building Flutter apps we make use of the Dart package management system pub.dev . Pub is very similar to other package managers from other languages. In order to install the Provider package into our project we will need to run the following command...

Getting started with state management in Flutter (Part 1)

Getting started with state management in Flutter (Part 1) Introduction Flutter is great for making beautiful cross-platform UIs with its everything is a widget concepts. But how do you actually move data around your application. State management is a huge part of any good application. State management is critical to providing a pleasurable user experience. We are going to dive into some of the basic state management concepts. Shift your design thinking to be declarative A huge paradigm shift when working in Flutter is thinking declaratively. The way most of our brains work make it easy to understand imperative programming concepts. When our code is organized as sequential steps we can follow the code for one branch of code to the next. When programming declaratively we describe what needs to be done and our system responds based on the action we describe. What does this mean for Flutter?  In Flutter we describe what should be done in our app and Flutter responds by drawing our...