tezvyn:

Flutter & Dart

Flutter framework, Dart language, packages, Impeller

307 bites

Flutter & Dart83 sec read

Dart reduce versus fold on collections

WHAT IT TESTS: choosing the right aggregation. OUTLINE: reduce combines same-type elements and throws on empty; fold takes an initial value and accumulator of any type, safe on empty. RED FLAG: using reduce when the result type differs from the elements.

Flutter & Dart81 sec read

Auth-protected routes via GoRouter redirect

WHAT IT TESTS: guarding routes with redirect. OUTLINE: a top-level redirect reads auth state, sends unauthenticated users to login, sends logged-in users away from login, and uses refreshListenable to re-evaluate on auth change.

Flutter & Dart76 sec read

Isolating and reducing excessive widget rebuilds

WHAT IT TESTS: narrowing rebuild scope. OUTLINE: push state down, use const subtrees, rebuild only listeners with ValueListenableBuilder, isolate repaints with RepaintBoundary.

Flutter & Dart82 sec read

iOS code signing for a TestFlight release

WHAT IT TESTS: understanding Apple's signing model. OUTLINE: a signing certificate proves who built the app; a provisioning profile ties cert, app ID and devices together; configure in Xcode, archive and upload.

Flutter & Dart69 sec read

Testing a tap that triggers a SnackBar

WHAT IT TESTS: widget-test interaction flow. OUTLINE: pumpWidget the app, find the button, tester.tap it, call pump or pumpAndSettle to advance frames, then expect a SnackBar finder. RED FLAG: forgetting to pump after the tap so the SnackBar never appears.

Flutter & Dart75 sec read

MethodChannel data flow and type marshalling

WHAT IT TESTS: how platform channels marshal data. OUTLINE: Dart invokeMethod sends a StandardMessageCodec-serialized payload to native, which returns a primitive or map; complex objects must be reduced to supported types.

Flutter & Dart76 sec read

Building a custom implicitly animated widget

WHAT IT TESTS: understanding the implicit animation machinery. OUTLINE: extend ImplicitlyAnimatedWidget, use AnimatedWidgetBaseState, define tweens in forEachTween, read values in build.

Flutter & Dart76 sec read

Diagnosing and fixing CustomPainter jank

WHAT IT TESTS: optimizing custom canvas rendering. OUTLINE: avoid work in paint, gate repaints with shouldRepaint, isolate with RepaintBoundary, cache static layers. RED FLAG: blaming the device or repainting everything every frame.

Flutter & Dart74 sec read

Immutable bloc state versus mutable ChangeNotifier

WHAT IT TESTS: reasoning about state mutability trade-offs. OUTLINE: immutable gives predictable diffs, easy debugging and replayability at the cost of boilerplate; mutable is terse but error-prone. RED FLAG: declaring one universally superior with no nuance.

Flutter & Dart76 sec read

Provider package versus raw InheritedWidget

WHAT IT TESTS: why Provider wraps InheritedWidget. OUTLINE: it removes boilerplate, adds lifecycle disposal and scoped reads, and exposes select for granular rebuilds. RED FLAG: thinking Provider is unrelated to InheritedWidget or is its own state engine.

Flutter & Dart77 sec read

Per-tab navigation stacks with StatefulShellRoute

WHAT IT TESTS: building independent per-tab stacks. OUTLINE: StatefulShellRoute keeps a separate Navigator and preserved state per branch, with a shared shell scaffold. RED FLAG: rebuilding tab contents or losing scroll and stack on tab switch.

Flutter & Dart76 sec read

LayoutBuilder versus MediaQuery for responsive widgets

WHAT IT TESTS: knowing layout constraints versus screen metrics. OUTLINE: MediaQuery reports the whole window; LayoutBuilder gives the parent's actual constraints. RED FLAG: claiming they are interchangeable for sizing nested components.

Flutter & Dart2 min read

Classic BLoC with Streams and Sinks

Classic BLoC separates UI from business logic by exposing inputs as Sinks and outputs as Streams. The widget pushes events into sinks, the BLoC processes them, and emits new state on streams that the UI rebuilds from, keeping logic testable and…

Flutter & Dart2 min read

How would you optimize Flutter CI build times beyond caching?

Tests platform build pipeline knowledge and CI design. Answers hit Gradle parallelism and R8 config for Android, Xcode derived data, target thinning on iOS, plus Dart AOT flags and sharding.

Flutter & Dart2 min read

Securely inject secrets for build flavors in CI/CD

WHAT IT TESTS: Secret management and threat modeling for CI/CD build flavors. ANSWER OUTLINE: Contrast CI environment variable injection with runtime secrets-manager fetches via CLI, comparing rotation overhead and blast radius.

Flutter & Dart2 min read

Propose a Dart FFI approach to share camera frames and its risks

Tests zero-copy frame sharing via Dart FFI plus ownership and thread hazards. Propose native allocation, pass pointer to Dart as external TypedData, use ring buffer, then free; cite use-after-free and races.

Flutter & Dart2 min read

Structure a POST request to send a Dart object as JSON

WHAT IT TESTS: Your grasp of HTTP semantics and Dart serialization. ANSWER OUTLINE: Set Content-Type application/json, serialize to Map via toJson, encode with dart:convert jsonEncode, and pass the string as body.

Flutter & Dart2 min read

Design a BLoC solution for an API call that updates multiple UIs

Decoupled BLoC orchestration for multi-surface updates. Use a coordinator stream so each BLoC subscribes independently while keeping loading and error states local per widget. Directly nesting one BLoC inside another or using global variables for shared state.

Flutter & Dart2 min read

Riverpod providers are objects, not widgets. What are the practical advantages?

Tests architectural decoupling of state and UI in Flutter. Strong answers hit compile-time safety, unit testing without widget trees, and logic that survives outside BuildContext. Red flag: praising syntax sugar without explaining the coupling problem.

Flutter & Dart2 min read

Design an immutable UserSettings class with copyWith for Flutter state

Tests immutability as Flutter's state foundation. A great answer shows final fields, a const constructor, copyWith with nullable named params and null-aware fallback, and explains how immutability prevents accidental shared mutations during rebuilds.