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?
Stack with Image first (bottom), then Center-wrapped indicator; constrain Stack to image.
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.
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.
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
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.
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.
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.
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.
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.
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.
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'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.
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.
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.
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.
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.
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.
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.
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.
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.