Flutter & Dart (50 Qs)•Part 1: Basic & Foundational Concepts (Junior / Entry-Level)
What is the difference between `StatelessWidget` and `StatefulWidget`?
junior LevelflutterBasic
In Simple Words:
StatelessWidget: Immutable. Its UI configuration depends solely on arguments passed into its constructor. It has no internal mutable state that changes over time (e.g.Text,Icon). OverridesWidget build(BuildContext context).StatefulWidget: Mutable. Maintains state that can change during the widget's lifetime (e.g. user input, check boxes, network data).- Composed of two classes: the immutable
StatefulWidgetconfiguration and the persistentState<T>object that holds mutable fields and callssetState().
- Composed of two classes: the immutable