Filter by the role you are applying for, open a question, and practise explaining the answer out loud. Mark it practised when you can.
Why they ask this: The first concept of every Flutter app; it shows you understand how the UI rebuilds.
Answer
StatelessWidget has no mutable state. Its build() output depends only on its constructor arguments (and inherited data such as the theme). Examples: a label or an icon button.StatefulWidget has a separate State object that lives across rebuilds. Calling setState() marks it dirty so build() runs again. Examples: a form, a counter, a tab view.class Counter extends StatefulWidget {
const Counter({super.key});
@override
State<Counter> createState() => _CounterState();
}
class _CounterState extends State<Counter> {
int count = 0;
@override
Widget build(BuildContext context) {
return TextButton(
onPressed: () => setState(() => count++),
child: Text('Tapped $count times'),
);
}
}Use the State lifecycle methods: initState() for setup and dispose() to release controllers, streams and timers.
Why they ask this: A practical question that shows real hands-on Flutter experience.
Answer
main(), so all state is lost. It is still faster than a full rebuild.AndroidManifest.xml or Info.plist edits, and some asset changes.Hot reload will not pick up changes to main(), initState() logic that already ran, global or static variable initialisers, or enum and generic type changes. Use hot restart for those.