Explain StatelessWidget vs StatefulWidget and when to choose each
This tests immutable UI versus persistent state. StatelessWidget rebuilds when config changes; StatefulWidget owns State surviving rebuilds. Use StatelessWidget for static UI and StatefulWidget for interactive elements.
This tests your understanding of immutable configuration versus mutable state. StatelessWidget is immutable and rebuilds only when its parent passes new arguments. StatefulWidget splits the disposable widget from a persistent State object that survives rebuilds. Choose StatelessWidget for static content like icons or text, and StatefulWidget for interactive elements that respond to input or animations. A red flag is claiming StatefulWidget is more powerful and using it as the default for every screen, adding unnecessary lifecycle overhead.
Read the original → docs.flutter.dev
- #flutter
- #widgets
- #state-management
- #interview
- #dart
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.