All jobs / Mobile developer / Cross-Platform
Mobile developer interview question · 0–1 years
A Flutter screen rebuilds the whole tree on every keystroke. What is the first fix?
The strongest answer
Lift only the state that must change, rebuild the leaf (or use a targeted widget), and keep expensive work out of build()
Why it works
Exactly. build() should be cheap and local. Rebuild the thing that changed.
What a good answer covers
- Keep build() cheap.
- Rebuild the smallest widget that needs it.
- Do not parse or decode in build().
- Profile a release build before you rewrite the app.
Answers that fall short
- Close, but not the strongest: Call setState at the MaterialApp so everything stays in sync
Rebuilding the world is the problem, not the fix. - Weak: Put the TextField in a separate isolate
Isolates are for CPU work, not for a TextField. - Red flag: Disable the widget inspector; rebuilds are an debug-only illusion
Inspector shows a real cost. Profile a release build if you doubt it.
Who gets asked this
More Cross-Platform questions
- A React Native list reshuffles items and several rows show the wrong image. What do you look at first?
- How do you treat the Android system Back button versus iOS’s interactive pop?
- Flutter needs a platform API the plugin ecosystem does not cover. How do you reach it?
- A React Native app is still on the old bridge. When do you move to the New Architecture?
- A Flutter screen parses a large file and the UI freezes for about a second while it does. Why, and what do…
- A cross-platform codebase has is-iOS / is-Android checks scattered through the screens, and a fix for one…
- A Flutter upgrade enables Impeller everywhere. What do you do before the store push?
- A native app will host one React Native flow. What do you insist on?