Recall & Review
beginner
What is a StatelessWidget in Flutter?
A StatelessWidget is a widget that does not store any state. It builds its UI once and does not change unless its inputs change.
Click to reveal answer
beginner
How do you create a StatelessWidget in Flutter?
You create a class that extends StatelessWidget and override the build method to return the widget tree.Click to reveal answer
beginner
Why use StatelessWidget instead of StatefulWidget?
Use StatelessWidget when your UI does not need to change dynamically. It is simpler and more efficient for static content.
Click to reveal answer
beginner
What method must you override in a StatelessWidget?
You must override the
build(BuildContext context) method to describe the UI.Click to reveal answer
intermediate
Can a StatelessWidget have mutable variables?
No, a StatelessWidget should not have mutable state because it cannot rebuild itself when data changes.
Click to reveal answer
What happens when the inputs of a StatelessWidget change?
✗ Incorrect
A StatelessWidget rebuilds when its inputs (properties) change, but it does not hold any internal state.
Which method do you override to define the UI of a StatelessWidget?
✗ Incorrect
The build() method returns the widget tree and defines the UI.
StatelessWidget is best used when:
✗ Incorrect
StatelessWidget is for static UI that does not change during the app lifecycle.
Which of these is true about StatelessWidget?
✗ Incorrect
StatelessWidget rebuilds only when its inputs change; it has no State object.
What is the return type of the build method in StatelessWidget?
✗ Incorrect
The build method returns a Widget that describes the UI.
Explain what a StatelessWidget is and when you should use it.
Think about widgets that never change after they are built.
You got /4 concepts.
Describe the steps to create a simple StatelessWidget in Flutter.
Focus on the class structure and the build method.
You got /4 concepts.