Stateless & stateful widgets
Explore the fundamental concepts of stateless and stateful widgets in Flutter. Understand how stateless widgets are immutable and built once, while stateful widgets can change and rebuild multiple times. This lesson helps you grasp widget state management essential for building interactive Android apps with Flutter.
We'll cover the following...
We'll cover the following...
Stateless widget
- A
Statelesswidget is immutable. Once it’s created, it can’t be changed. It doesn’t preserve its state. - Stateless widget is drawn only once, and it can not be redrawn at a later time.
- Stateless widget’s
build()method is called only once.
Let’s use the Container widget to understand creating a custom StatelessWidget.
Container Widget: ...