Skip to content
tezvyn:

All bites

The whole library, newest first. Filter by what you are here for, or pick a topic if you already know.

8668 bites

Page 168

Flutter & Dart2 min read

Explain the core responsibilities of RouterDelegate, RouteInformationParser, and Router in Flutter

Tests Navigator 2.0 architecture split. RouteInformationParser converts URLs to typed config; RouterDelegate owns state and builds the Navigator; Router wires them together and handles engine intents. Red flag: conflating parsing and state or omitting Router.

Flutter & Dart2 min read

Navigator.push vs Navigator.pushNamed in Flutter

Tests Flutter navigation patterns and scalability. A strong answer contrasts inline widget construction with centralized route tables, noting pushNamed centralizes routes but complicates type-safe data. Red flag: named routes are always better for large apps.

Flutter & Dart2 min read

How do you pass data with Navigator.push and return data with Navigator.pop?

Tests imperative navigation and async result patterns. Strong answer: push via MaterialPageRoute with constructor args; await the Future from Navigator.push; pop with Navigator.pop(context, result). Red flag: using global state instead of the Future result.

Flutter & Dart2 min read

Explain Flutter's GestureArena and overlapping detector scenario

The arena opens on pointer down; recognizers accept or reject; the last accepted member wins.

Flutter & Dart2 min read

Implement efficient async username validation in Flutter

Tests async field hygiene in Flutter. Outline: debounce 300ms, cancel inflight requests, decouple loading UI from errors, use reactive_forms async validators or manual streams. Red flag: API calls per keystroke without cancellation, loading treated as errors.

Flutter & Dart2 min read

What gesture conflict exists in a scrollable list with horizontal swipes?

Tests Flutter's gesture arena and slop disambiguation. Diagonal motion triggers both vertical scroll and horizontal swipe; the axis whose delta exceeds touch slop first wins the arena. Red flag: claiming Flutter blocks inner gestures or fires both at once.

Flutter & Dart2 min read

What is a FocusNode and why is it useful in forms?

This tests your understanding of Flutter's imperative focus tree. A strong answer defines FocusNode as a persistent focus target, explains programmatic form navigation, and stresses initState creation and dispose.

Flutter & Dart2 min read

Build and validate a login form with Form and GlobalKey

This tests Flutter's declarative form validation. A strong answer covers wrapping fields in a Form, using a GlobalKey<FormState>, calling validate on submit, and acting only on true.

Flutter & Dart2 min read

Explain the validator property in TextFormField and what triggers error display

Tests Form validation lifecycle knowledge. Strong answer: validator returns String? error or null; formKey.currentState.validate() triggers all fields; returned string renders as inline error.

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 & 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 & 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 & 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.

How do you split a Column 1/3 and 2/3 using Expanded?
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.

In a Row, how do you space children evenly across the width?
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.

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.