More in Flutter & Dart — page 4
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.
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.
How would you draw a line graph using Canvas and Path?
WHAT IT TESTS: Fluency with Flutter's imperative drawing model and Path construction. ANSWER OUTLINE: Use moveTo for the first point, lineTo for the rest, then Canvas.drawPath with a stroke Paint.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.

Implement an API caching layer with offline support and storage trade-offs
WHAT IT TESTS: Designing a tiered cache for speed and resilience. ANSWER OUTLINE: Use in-memory for hot data and disk for offline, pick Hive or SQLite by shape, and use TTL with a sync queue. RED FLAG: Ignoring invalidation or treating all data identically.
Explain Dio interceptors and automatic token refresh
WHAT IT TESTS: Stateful middleware and async orchestration. ANSWER OUTLINE: Define interceptors as hooks; queue concurrent 401s during refresh; retry with Bearer header via token manager. RED FLAG: Synchronous refresh or refresh storms.
How would you manage network request state in a Flutter widget?
This tests whether you separate ephemeral widget state from business logic. A good answer defines a state class, uses setState in initState, then shows how a library moves logic out for testing and reuse. Red flag: fetch inside build or using boolean flags.
Compare manual JSON serialization versus json_serializable
It tests build automation versus manual control in Dart serialization. Manual methods avoid build steps but risk drift; code generation cuts boilerplate but adds compile latency. Claiming code gen slows runtime or that manual is always simpler.
Describe a robust error handling strategy for network requests
Tests whether you classify failures by layer rather than catching everything generically. Inspect DioExceptionType for connectivity, check HTTP status before parsing, and isolate JSON decode errors. Never show the same message for timeouts and 500s.