Rapid-fire questions
The first ten minutes of an interview usually bring short, factual questions. Their purpose is not to test depth but to confirm the basics are in place. Answers should be one or two sentences: a long explanation reads as weakness here.
The tables below are ready short answers. Rehearse them out loud — answering without hesitation matters nearly as much as knowing.
| Question | Short answer |
|---|---|
| What does `setState` do? | It changes state and marks the widget dirty; all descendants of that `State` rebuild. |
| Difference between `context.watch` and `context.read`? | `watch` subscribes and triggers rebuilds; `read` only reads and belongs in callbacks. |
| What is `InheritedWidget` for? | Passing data down the tree and notifying dependents via `updateShouldNotify`; Provider wraps it. |
| When does a `ValueNotifier` notify? | When the new value is not equal to the old one under `==`. |
| Where is `ref.watch` used in Riverpod? | In `build` and in a provider's body; the docs call it the go-to choice. |
| What is `AsyncValue`? | A Riverpod type unifying loading/error/data in one sealed type. |
| What does `autoDispose` do? | Clears a provider's state when no listener remains; on by default with codegen. |
| What is `family` for? | Passing an argument to a provider; state is kept separately per argument. |
| Difference between Cubit and Bloc? | Cubit changes state through methods, Bloc through events; Bloc adds traceability and event transformations. |
| How does bloc handle duplicate states? | When `state == nextState`, no change occurs. |
| Why is `BlocListener` needed? | For side effects without a rebuild: snackbars, dialogs, navigation. |
| Why use `Equatable`? | To give state value semantics; without `==` the rebuild filters cannot work. |
| Question | Short answer |
|---|---|
| "The UI doesn't update" — the first three suspects? | A non-subscribing read (`read`), no notification sent, and `==` seeing no difference because the state is mutable. |
| Cause of `ProviderNotFoundException`? | No such provider above the `context` used for the read (a dialog, a new route, its own context). |
| How do you replace a dependency in a Riverpod test? | `ProviderContainer.test(overrides: [...])` or `ProviderScope(overrides: [...])`. |
| What is `blocTest`'s `seed` parameter? | It seeds an initial state so the test starts from a given situation. |
| What does the `droppable` transformer do? | Drops events added while one is being processed (preventing double payments). |
| Using `context` after an `await`? | You need a `mounted` check; the `use_build_context_synchronously` lint catches it. |
| Where should state live — the official answer? | UI state in the view model, shared/session state in a repository; services hold none. |
| What does a `const` constructor give performance? | It lets Flutter short-circuit most of the rebuild work — an official recommendation. |
| How do you measure rebuilds? | DevTools → Performance → **Track Widget Builds**. |
| `valueOrNull` in Riverpod 3? | Renamed to `value`; and `AsyncValue` became sealed. |
| Where is `mapEventToState`? | Removed in bloc v8.0.0 in favour of `on<Event>`. |
| Which library performs best? | All three share the same mechanism; performance is set by subscription scope and immutability. |
There are two traps in the rapid-fire round. The first is talking too much: if the question is "what does X do?", two sentences are enough; if they want depth, they will ask. The second is hiding what you don't know: "I don't remember exactly, but the approach is..." beats inventing an answer, and an experienced interviewer values it.
📚 Sources and documentation
- Flutter: state management docsofficialdocs.flutter.dev
- Riverpod docsofficialriverpod.dev
- Bloc conceptsofficialbloclibrary.dev
- package:providerofficialpub.dev