Stateful versus stateless widgets

From Chapter 3, An Introduction to Flutter, we have seen that widgets play an important role in Flutter application development. They are the pieces that form the UI; they are the code representation of what is visible to the user.

UIs are almost never static; they change frequently, as you know. Although immutable by definition, widgets are not meant to be final – after all, we are dealing with a UI, and a UI will certainly change during the life cycle of any application. That's why Flutter provides us with two types of widgets: stateless and stateful.

The big difference between these is in the way the widget is built. It's the developer's responsibility to choose which kind of widget to use in each situation to compose the UI in order to make the most of the power in the widget rendering layer of Flutter.

Flutter also has the concept of inherited widgets (the InheritedWidget type), which is also a kind of widget but is a little bit different from the other two types that we've mentioned. We will check it out after we've explored the hello_flutter example from Chapter 3, An Introduction to Flutter, in detail. 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.127.232