ABSTRACT

This chapter sheds light on the importance of managing states in a Flutter application. Needless to say, that any real-world application requires to manage their application states sooner or later. A simple app needs only one screen in the beginning. However, many more screens keep adding to the app to support the new functionalities and features. These additional screens may need to know the state of the application at a given time. When it comes to building Flutter applications where everything is a ‘widget’, the deeply nested widget trees start to build up quickly. The widgets in widget-trees might need to share the application's state and pass their state to other widgets. It becomes crucial to handle the widget's state sharing or ‘State Management’ appropriately and efficiently to avoid the scaling issues that can lead to technical debts. In Flutter development, the architecture patterns and state management are used interchangeably. However, architecture patterns help to streamline code organization into separate layers to segregate responsibilities. There are many options to manage the state of the application in the Flutter applications. The Flutter app states are categorized into two types: Local (or Ephemeral) State and Application State.