Flutter is Google’s open-source tech for building cross-platform apps with a single codebase. It is a full-fledged SDK that includes everything necessary to build a native mobile app.
State management is the process of maintaining knowledge of inputs across multiple related data flows that form a complete business transaction ( Tom Nolle). For example; when you log on to a website, your information needs to be remembered and different parts of the website may need to get access to your information. In this case, the state is your information, and the process of making sure that it is available to other parts of the website is state management.
When building apps with Flutter, state can be easily managed by using a framework called GetX which is extra-light yet powerful. It combines high-performance state management, intelligent dependency injection, and route management quickly and practically. Below is a simple example of how GetX helps manage state.
The state (number) is initially 0, the .obs is to say that the state is observable, meaning whenever it changes, the widget observing it will be updated to show the latest state. Any widget that is observing a state must be returned by the Obx widget that comes with GetX. In the above image, the Text widget is displaying the state and that is why it is being returned by Obx.
GetX is a great framework! Using it to manage state removes a lot of boilerplate, simplifies code, and speeds up development.
Block B Infinity Office Park,4 Pieter Wenning Road, Fourways, JohannesburgSouth AfricaPhone: +27 10 822 3570Contact us