📱 Flutter
Beginner
What is the difference between StatelessWidget and StatefulWidget?
Answer
A StatelessWidget has no mutable state — it renders based solely on the constructor arguments passed to it and never changes after being built. It is ideal for static UI elements like labels or icons. A StatefulWidget maintains a separate State object that can change over time in response to user interactions or data updates, triggering a UI rebuild. When state changes, you call setState() inside the State object to notify Flutter to rebuild the widget.