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.

8664 bites

Page 24

Which widget overlays and centers a loading indicator on an image?
Flutter & Dart2 min read

Which widget overlays and centers a loading indicator on an image?

Stack with Image first (bottom), then Center-wrapped indicator; constrain Stack to image.

Flutter & Dart2 min read

Full-Text Search in Local Flutter Databases

SQLite FTS5 is an inverted index in your app: words map to row IDs, skipping brute-force scans. Use it when local tables exceed thousands of rows and LIKE lags. The footgun is that FTS virtual tables never auto-sync, so stale indexes return wrong rows.

Flutter & Dart2 min read

Describe a strategy to decouple TextEditingController from global state

It tests your understanding of ephemeral versus app state in Flutter. Keep the controller local, debounce input so finalized values reach BLoC or Riverpod, and let the field own its state while editing.

Flutter & Dart2 min read

AnimatedContainer: Simple UI Animations Without Controllers

AnimatedContainer is a 'fire-and-forget' animation widget. It automatically animates its own properties like size and color when they change. Use it for simple UI state changes, like a button that grows when tapped. It only animates itself, not its child.

Describe the BLoC pattern: Events, States, and widget connection
Flutter & Dart2 min read

Describe the BLoC pattern: Events, States, and widget connection

Tests UI-business separation. Strong answers cast Events as user intents, States as immutable snapshots, and BLoC as a pure reducer. Widgets listen via BlocBuilder and dispatch via context.read. Red flag: mutating state directly or using setState inside BLoC.

Flutter & Dart2 min read

TweenAnimationBuilder: Animate Anything Implicitly

TweenAnimationBuilder animates any widget property without a complex AnimationController. Just give it a target value, duration, and curve. Use it for one-off animations where a full controller is overkill.

Flutter & Dart2 min read

When to use shared_preferences and its primary limitations?

This tests whether you know appropriate local persistence tiers. A strong answer names simple primitives like flags or tokens, notes async disk writes, and warns against large blobs, relational data, or secrets.

Flutter & Dart2 min read

CurvedAnimation: Animate with Easing and Personality

CurvedAnimation makes animations feel natural by applying a timing curve to another animation. Instead of linear motion, widgets can ease-in or bounce. Footgun: Elastic curves can overshoot the standard 0.0-1.0 range, causing unexpected UI behavior.

Flutter & Dart2 min read

Fix UI jank from file reads and SQLite inserts using Isolates

This tests whether you know heavy synchronous work blocks Dart's UI event loop past the 16ms frame budget. A strong answer offloads parsing and SQLite inserts to a worker isolate via compute, returning results.

Flutter & Dart2 min read

AnimationController: The Conductor of Your Animation

An AnimationController is the conductor for your animation's timing. It produces values from 0.0 to 1.0 over a duration, letting you play, reverse, or stop animations. Use it to drive widgets like SlideTransition.

Flutter & Dart2 min read

Compare sqflite and Drift: trade-offs and when to choose Drift

This tests Flutter persistence trade-offs. Contrast sqflite's raw maps and raw SQL with Drift's typed code, streams, and migrations; choose Drift for complex schemas or web targets. Red flag: calling Drift bloat or claiming raw sqflite is always faster.

Flutter & Dart2 min read

Flutter's Tween: The Recipe for Animation

A Tween is a recipe for animation, not the animation itself. It maps a 0.0-1.0 progress value to a concrete value, like a color or position. Use it with an AnimationController to smoothly transition a widget's properties.

Flutter & Dart2 min read

Set up an integration test for a multi-screen login flow

This tests your grasp of integration_test's device runtime versus headless widget tests. A strong answer covers the integration_test directory, ensureInitialized, driving a login flow end-to-end on device.

Flutter & Dart2 min read

AnimatedBuilder: Isolate Animation Rebuilds for Performance

Flutter's AnimatedBuilder rebuilds only the widgets that change during an animation, not the entire screen. Use it to embed a moving part within a larger static widget, like a spinning icon on a button, to maximize performance.

Flutter & Dart2 min read

How do you test Flutter platform channels and mock native responses?

Tests MethodChannel mocking in widget tests. Strong answers intercept calls via TestDefaultBinaryMessengerBinding, encode replies with StandardMessageCodec, pump the widget, and assert UI state.

Flutter & Dart2 min read

CustomPaint: Drawing Your Own Widgets in Flutter

CustomPaint is your blank canvas widget; CustomPainter is the artist that draws on it. Use them for custom charts or unique UI. The footgun: shared canvases can cause blend modes to erase other widgets, so use saveLayer sparingly.

Flutter & Dart2 min read

How do you handle CPU-bound tasks without freezing the Flutter UI?

Tests whether you know async/await yields for I/O but cannot parallelize CPU work. A strong answer defines Isolates as isolated heaps with message-passing, contrasts them with threads, and shows how compute() wraps Isolate.spawn.

Flutter & Dart2 min read

ClipPath: Clip Widgets to Custom Shapes

ClipPath is a stencil for your widgets. It cuts a child widget to a custom-defined shape, hiding anything outside the lines. Use it for complex shapes like waves or stars, but avoid it for simple rectangles or circles—it's expensive.

Flutter & Dart1 min read

Auth-protected routes via GoRouter redirect

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 & Dart2 min read

Staggered Animations: Choreographing UI Changes

A staggered animation is a domino effect for your UI. Instead of animating everything at once, you sequence animations with slight delays for a more fluid, polished feel. Use it for list items appearing one by one. The footgun is timing: too long feels slow.