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.

4330 bites

Page 11

Implement an API caching layer with offline support and storage trade-offs
Flutter & Dart2 min read

Implement an API caching layer with offline support and storage trade-offs

Use in-memory for hot data and disk for offline, pick Hive or SQLite by shape, and use TTL with a sync queue.

Flutter & Dart2 min read

Why are stale search requests problematic and how do you cancel them?

This tests race conditions and resource waste in async UI. Strong answers note stale requests waste bandwidth and overwrite newer results; cancel the previous call with a CancelToken before issuing the next.

Flutter & Dart2 min read

When to use SQLite over key-value storage?

Tests structured-vs-flat storage judgment. Good answers cite relational data, complex queries, or multi-table schemas, then list adding the dependency, getting a path, opening with onCreate, and keeping a singleton.

Flutter & Dart2 min read

Why is Flutter local storage async and how do you use shared_preferences?

Tests why disk I/O must avoid blocking Dart's UI thread. A strong answer shows async/await with getInstance and setters, notes legacy getters are sync-after-cache, and warns writes may not persist instantly.

Flutter & Dart2 min read

Key difference between shared_preferences and flutter_secure_storage for tokens

Tests at-rest encryption: shared_preferences stores plain text XML/plist, while secure storage uses iOS Keychain and Keystore with RSA OAEP plus AES-GCM. Answers cite backup risks and hardware keys. Red flag: calling prefs safe or relying on obfuscation.

Flutter & Dart2 min read

What is an sqflite transaction? Provide a practical example.

Tests atomicity in SQLite and isolate safety. A strong answer defines all-or-nothing execution, gives a fund-transfer example updating both, and warns sqflite transactions are not cross-isolate safe. Red flag: omitting rollback or multi-isolate writes.

Flutter & Dart2 min read

How do you safely add a non-nullable column in sqflite?

Tests onCreate for fresh installs vs onUpgrade for existing data. Outline: bump version; in onUpgrade use ALTER TABLE ADD COLUMN NOT NULL DEFAULT for existing rows; keep onCreate as latest schema. Red flag: only changing onCreate so old users crash.

Flutter & Dart2 min read

Implicit vs explicit animations: AnimatedContainer or AnimationController?

Knowledge of Flutter's implicit versus explicit animation paradigms. Implicit widgets auto-animate property changes on rebuild; explicit controllers manage playback manually. Red flag: saying explicit is always superior or that implicit animations cannot stop.

Flutter & Dart2 min read

Describe CustomPaint and CustomPainter and implement a circle

This tests Flutter's render delegation. Separate CustomPaint, the canvas widget, from CustomPainter, the drawing logic; cover canvas.drawCircle and shouldRepaint returning false. Red flags: calling setState in paint or ignoring shouldRepaint.

Flutter & Dart2 min read

How do AnimationController and TickerProvider work together to drive animations?

Tests your grasp of Flutter's imperative animation engine. AnimationController stores value and direction; TickerProvider (via vsync) schedules frame callbacks; paired they emit 60–120 ticks per second.

Flutter & Dart2 min read

Compare AnimatedBuilder and Transition widgets for explicit animations

Tests whether you know how explicit animations rebuild the widget tree and where to isolate animation effects. AnimatedBuilder rebuilds only its builder subtree, while Transition widgets rebuild their child when the animation ticks.

Flutter & Dart2 min read

How does Tween work and how do you use ColorTween with Curves?

This tests value interpolation versus time remapping. A strong answer: Tween maps 0-1 to typed values; ColorTween lerps 2 colors; Curves.easeInOut warps input time before interpolation. Red flag: claiming the curve alters the color output instead of timing.

Flutter & Dart2 min read

In a CustomPainter, what is the purpose of the shouldRepaint method?

This tests Flutter repaint optimization. Answer: shouldRepaint compares old and new delegates, returning true only when visual properties differ so the framework skips paint calls. A red flag is returning true unconditionally, forcing useless repaints.

Flutter & Dart2 min read

How would you draw a line graph using Canvas and Path?

Use moveTo for the first point, lineTo for the rest, then Canvas.drawPath with a stroke Paint.

Flutter & Dart2 min read

Implement staggered animations using a single AnimationController and Interval

This tests multiplexing one ticker into sequential animations. Use one AnimationController, map each Tween to an Interval on distinct 0-to-1 sub-ranges, and rebuild with AnimatedBuilder. Red flag: multiple controllers or manual forward chaining.

Flutter & Dart1 min read

Diagnosing and fixing CustomPainter jank

Avoid work in paint, gate repaints with shouldRepaint, isolate with RepaintBoundary, cache static layers.

Flutter & Dart1 min read

Building a custom implicitly animated widget

Extend ImplicitlyAnimatedWidget, use AnimatedWidgetBaseState, define tweens in forEachTween, read values in build.

Flutter & Dart2 min read

What native iOS and Android config does the Flutter camera plugin need?

Tests native platform knowledge beyond Dart. iOS requires NSCameraUsageDescription and NSMicrophoneUsageDescription in Info.plist. Android needs minSdk 24 and choosing between CameraX or Camera2 implementations.

Flutter & Dart2 min read

Explain the purpose of MethodChannel and how it enables Dart-to-native calls

MethodChannel lets Dart encode a method call; the platform host decodes it on the main thread, runs native code, and returns an async result.

Flutter & Dart1 min read

MethodChannel data flow and type marshalling

Dart invokeMethod sends a StandardMessageCodec-serialized payload to native, which returns a primitive or map; complex objects must be reduced to supported types.