Skip to content
tezvyn:

Flutter

294 bites tagged Flutter — interview questions with model answers, and 60-second explainers.

Flutter & Dart2 min read

How do you retrieve and listen to TextField changes in Flutter?

Use TextEditingController, attach to TextField, listen with addListener, read controller.text, dispose in State.dispose. Flutter input state and lifecycle hygiene. Citing onChanged as standard or forgetting disposal.

Flutter & Dart2 min read

Handle taps on a non-button Container: GestureDetector vs InkWell

This tests gesture propagation and Material feedback. Use GestureDetector for raw taps, drags, or scales; InkWell for Material ripples, which needs a Material ancestor. Red flag: InkWell without Material or ignoring GestureDetector drag support.

Flutter & Dart2 min read

What problem does IntrinsicWidth solve and what are its performance costs?

This tests Flutter constraints and intrinsic sizing. A great answer covers: capping width to the child's max intrinsic width, aligning Column children, and the speculative pass that costs O(N²) in tree depth. A red flag is omitting performance cost.

Flutter & Dart2 min read

Explain Flutter's 'constraints down, sizes up' rule and unbounded height error

Parents constrain down, children size up. ListView in Column throws unbounded height as Column gives infinite maxHeight; fix with Expanded or shrinkWrap. Flutter's constraint protocol.

Flutter & Dart2 min read

Describe a strategy for ListView on phones and GridView on tablets

This tests Flutter adaptive layout skills. Use LayoutBuilder or MediaQuery to read screen width, pick a breakpoint near 600 dp, and return ListView or GridView conditionally.

Flutter & Dart2 min read

Fix RenderFlex overflow in Row with long truncating text

Wrap Text in Expanded; set overflow to TextOverflow.ellipsis and maxLines: 1; leave siblings unwrapped. Flutter Row constraints and bounding Text width for ellipsis without affecting sibling sizes.

Flutter & Dart2 min read

How do Flexible and Expanded differ in a Row or Column?

Tests Flutter main-axis flex constraints. Key point: Flexible uses FlexFit.loose so the child may be smaller than its space share; Expanded uses FlexFit.tight so the child must fill its share.

Flutter & Dart2 min read

mainAxisAlignment vs crossAxisAlignment in Column, and textDirection in Row

Tests Flutter flex axis awareness. In a Column, mainAxisAlignment is vertical and crossAxisAlignment is horizontal. In a Row, textDirection governs the main axis, not crossAxisAlignment; verticalDirection governs the cross axis.

Flutter & Dart2 min read

How do you split a Column 1/3 and 2/3 using Expanded?

Tests understanding of flex allocation in Flutter layouts. Strong answers wrap both containers in Expanded, assign flex values of 1 and 2, and note that Expanded forces children to fill the Column's main axis. Red flag: proposing fixed heights instead of flex.

Flutter & Dart2 min read

In a Row, how do you space children evenly across the width?

Set mainAxisAlignment to spaceEvenly; contrast with spaceBetween and spaceAround. Row main-axis layout and MainAxisAlignment. Using manual SizedBox spacers instead of the built-in alignment enum.

Flutter & Dart2 min read

How does const on a widget constructor impact build and reconciliation?

Tests widget canonicalization and reconciliation. Strong answers: const creates identical widget instances; Element.updateChild skips subtree rebuild when oldWidget == newWidget, saving elements and GC.

Flutter & Dart2 min read

What are Keys in Flutter and why are they critical?

Tests widget identity during reconciliation. Keys let Flutter distinguish moved widgets from changed data; without ValueKeys, ReorderableListView leaves state at old positions, e.g., a checkbox swap. Red flag: calling them performance tools.

Flutter & Dart2 min read

Explain the lifecycle of a State object

List initState through dispose, emphasizing didUpdateWidget reacts to parent config changes. Your grasp of StatefulWidget state transitions and framework hook timing.

Flutter & Dart2 min read

Explain lifting state up with a concrete scenario and benefits

Tests moving state to a common ancestor when siblings share data. Outline: pick two siblings, hoist state to the parent, pass values and callbacks down. Red flag: mutating a sibling via GlobalKey or choosing Provider before proving the parent cannot own it.

Flutter & Dart2 min read

How can you prevent unnecessary child rebuilds in Flutter?

Tests your grasp of Flutter build-boundary isolation. Strong answers hit const constructors, extracting the child into its own widget, and granular state selectors. Red flag: saying Keys alone stop rebuilds or recommending RepaintBoundary to skip builds.

Flutter & Dart2 min read

What is BuildContext? Give two tree-interaction examples.

Tests if you know BuildContext is an Element handle to a widget's tree location. Strong answers cite Theme.of and Scaffold.of as ancestor lookups, explain the own-context trap, and warn against caching across async gaps. Red flag: calling it the widget itself.

Flutter & Dart2 min read

Relationship between Widget, Element, and RenderObject trees and their benefits

Widget configures, Element owns state, RenderObject paints; Element.update reuses the RenderObject, so rebuilds stay cheap. Your understanding of Flutter's three-tree separation of concerns.

Flutter & Dart2 min read

What is the build method's purpose and key constraints?

It returns a Widget tree, can run every frame, must avoid side effects, and uses BuildContext for inherited data. Your grasp of build as a pure, declarative function. Async work, state mutation, or assuming build runs once.

Flutter & Dart2 min read

Explain StatelessWidget vs StatefulWidget and when to choose each

This tests immutable UI versus persistent state. StatelessWidget rebuilds when config changes; StatefulWidget owns State surviving rebuilds. Use StatelessWidget for static UI and StatefulWidget for interactive elements.

Flutter & Dart2 min read

Explain StreamController, write a broadcast stream example, and why close it?

This tests Dart stream lifecycle and memory safety. A strong answer uses StreamController.broadcast(), adds data and errors, closes it, and explains unclosed controllers leak memory.

Flutter & Dart2 min read

Fetch user profiles concurrently and handle individual failures

Tests Future.wait concurrency and per-future error isolation. Answer: map IDs to fetchProfile, pass to Future.wait. For partial failures, attach catchError per future to return null, then filter. Red flag: try-catch around Future.wait or sequential awaits.

Flutter & Dart2 min read

Explain single-subscription vs broadcast Streams in Dart

Tests dart:async stream lifecycle. Outline: single-subscription allows one listener and emits on listen; broadcast supports many but drops events for late arrivals. Red flag: saying single-subscription allows multiple listeners or buffers events.

Flutter & Dart2 min read

Describe the Dart event loop and queue execution order

Tests your grasp of Dart's single-threaded event loop priority. Great answers state: microtasks drain fully before the next event processes, cycling forever. Red flag: saying Future and scheduleMicrotask interleave in call order.

Flutter & Dart2 min read

Difference between Future<void> and void from an async function

Future<void> lets callers await and catch errors; void hides the Future, preventing await and leaving exceptions uncaught. Knowledge that async always produces a Future. Believing void async returns are awaitable.

Get Flutter bites daily.

Five a day, five minutes, offline. With quizzes so it sticks.

Open testing — you’ll join as an early tester.