A stateless widget is a printed sign: it shows what it was given. A stateful widget has its own memory (a counter, a checkbox) and redraws itself when you call setState.
Say it like this in the interview
“Stateless widgets depend only on their constructor parameters. Stateful widgets keep a State object that persists across rebuilds; setState marks it dirty to rebuild. I keep state as low in the tree as possible and lift or share it with a state management solution when needed.”
You started a slow task (API call), the user left the screen (widget destroyed), then the task finished and tried to update a screen that no longer exists.
Say it like this in the interview
“An async callback calls setState after the widget was removed. I check if (!mounted) return; after awaits, cancel timers, streams and controllers in dispose, or move the async logic to a state-management layer.”
When widgets in a list are reordered, Flutter matches old and new by type and position. Keys are name tags so it can track which item is which and keep each one’s state.
Say it like this in the interview
“Keys preserve state when widgets of the same type move or are inserted in a collection. ValueKey with a stable ID for list items, GlobalKey sparingly for accessing state across the tree, like form validation.”
A widget’s address in the widget tree. You use it to find things above you, like the theme, navigator or an inherited state provider.
Say it like this in the interview
“BuildContext is a handle to the widget’s location in the element tree, used to look up ancestors like Theme.of(context) and Navigator.of(context). Using a context after the widget is unmounted causes errors, so I check mounted after awaits.”
There’s no single answer; interviewers want to hear trade-offs. Small app: built-in tools. Bigger app: Riverpod or Bloc for testable, predictable state.
Say it like this in the interview
“For local UI state, setState or ValueNotifier. For app state I prefer Riverpod for its compile-safe dependency graph and testability, or Bloc when the team wants explicit events and states with strict separation. The key is separating UI from business logic and data layers.”
Each frame has ~16ms. Something is doing too much work per frame: building all items at once, heavy images, or calculations on the UI thread.
Say it like this in the interview
“Use ListView.builder for lazy building, const constructors to avoid rebuilds, cached and resized images, avoid expensive Opacity/clip layers, and move heavy work like JSON parsing of big payloads to an isolate with compute or Isolate.run. I confirm in DevTools’ performance view.”
A Future is one value that arrives later (one API response). A Stream is many values over time (chat messages, location updates).
Say it like this in the interview
“A Future completes once with a value or error, used with async/await and FutureBuilder. A Stream emits multiple events, used with await for, listen and StreamBuilder. Subscriptions must be cancelled.”