Understanding the foundations – widgets, elements, and render objects
Before moving to the project creation, we want to review some fundamental concepts of the Flutter framework: Widget
, Element
, and RenderObject
types.
While a widget tree is created and managed by the developer, the Flutter framework builds and manages two other trees in parallel, called an element tree and a render object tree. At a very practical level, these three trees are used to build user interfaces (UIs) and decide when it’s time to refresh them. At the highest level, there are widgets, and they come in two flavors, as outlined here:
StatelessWidget
: This kind of widget doesn’t require a mutable state and is best used to describe those parts of the UI that never change. Stateless widgets are immutable.StatefulWidget
: This kind of widget has a mutable state and is generally used when the developer needs to control the widget’s life cycle or dynamic contents. Stateful...