Stateful vs Stateless Widgets in Flutter
Dive into the world of the two main types of widgets in Flutter and learn about their features and differences and when to use each one. By Emmanuel Okiche.
Who is this for?
Flutter, Android and iOS developers who are getting into Flutter and want to understand the differences between Stateful and Stateless widgets and learn when’s best to use which one.
Covered concepts
- Stateless Widget
- Stateful Widget
- The State Object
- Widget LifeCycle
- Working with Keys
Part 1: Stateful vs Stateless Widgets in Flutter
Get a brief overview of widgets and the concept of immutability and also create a simple UI using Stateless Widgets.
See how Stateful Widget differs from Stateless Widget with its ability to store a mutable state.
Learn about the lifecycle methods that come with a State object and see how they can be triggered at different times.
Stateless and Stateful Widgets are represented differently in the Element tree. Learn how Keys affect this process.
Get a summary of the difference between the two widget types and explore some in-built widgets in Flutter and see how they qualify for their widget types and use this knowledge to know the type of widget to create.