tezvyn:

Flutter & Dart

Flutter framework, Dart language, packages, Impeller

33 bites

Flutter & Dart30 sec read

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

WHAT IT TESTS: Stack overlays and centering non-positioned children. ANSWER OUTLINE: Stack with Image first (bottom), then Center-wrapped indicator; constrain Stack to image. RED FLAG: Column/Row or manual Positioned offsets instead of Stack/Center alignment.

Flutter & Dart30 sec read

What is a Dart Isolate and how does it differ from threads?

Tests Dart's shared-nothing concurrency model. Define an isolate as an independent heap plus event loop, contrast it with shared-memory threads, and explain UI isolate communication via async message ports.

Flutter & Dart30 sec read

Unit test a BLoC handling an AddItem event and emitting state

WHAT IT TESTS: Whether you know BLoC testing idioms and why bloc_test beats manual assertions. ANSWER OUTLINE: Use blocTest with build, act, expect; mention seed, skip, and mocktail for dependencies.

Flutter & Dart30 sec read

What is Pigeon and how does it improve platform channels?

This tests type-safe platform channels versus manual MethodChannel boilerplate. Answer: Pigeon is a dev-time code generator that creates typed host stubs from a Dart contract, removing string keys and encoding. Red flag: calling it a runtime library.

Flutter & Dart30 sec 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 & Dart30 sec 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 & Dart30 sec 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 & Dart30 sec 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 & Dart31 sec read

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.

Flutter & Dart30 sec read

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.

Flutter & Dart30 sec read

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.

Flutter & Dart30 sec read

Difference between context.watch, context.read, and Selector in Provider and Riverpod

Tests rebuild granularity in Flutter. A strong answer distinguishes listening versus one-time lookup, explains that Selector filters rebuilds by comparing sub-values, and warns that context.read inside build causes missed updates.

Flutter & Dart30 sec read

Implement efficient async username validation in Flutter

Tests async field hygiene in Flutter. Outline: debounce 300ms, cancel inflight requests, decouple loading UI from errors, use reactive_forms async validators or manual streams. Red flag: API calls per keystroke without cancellation, loading treated as errors.

Flutter & Dart33 sec read

How do you split a Column 1/3 and 2/3 using Expanded?

Tests understanding of flex allocation in Flutter layouts. Strong answers wrap both containers in Expanded, assign flex values of 1 and 2, and note that Expanded forces children to fill the Column's main axis. Red flag: proposing fixed heights instead of flex.

Flutter & Dart30 sec read

Describe the Dart event loop and queue execution order

Tests your grasp of Dart's single-threaded event loop priority. Great answers state: microtasks drain fully before the next event processes, cycling forever. Red flag: saying Future and scheduleMicrotask interleave in call order.

Flutter & Dart30 sec read

Explain Dart's event loop, microtask queue, event queue, and await behavior

Tests Dart single-threaded event loop model. Strong answer: microtasks drain before event queue tasks; await suspends the function and schedules its resumption via the event loop when the Future completes. Red flag: claiming await blocks the thread.

Flutter & Dart31 sec read

Describe Dart's null-aware ?. and null assertion ! operators

Tests Dart null safety mechanics: ?. short-circuits member access on null, while ! casts away nullability. A strong answer notes ?. avoids NPEs and ! is a risky opt-out. Red flag: claiming ! is safe or that ?. provides a default value.

Flutter & Dart30 sec read

StateNotifierProvider: Manage Immutable State

StateNotifierProvider bundles immutable state with the logic to change it. It's ideal for managing complex objects like a todo list by exposing methods like `addTodo`.

Flutter & Dart30 sec read

Flutter Flavors: One Codebase, Multiple App Versions

Flutter Flavors let you build multiple app versions from one codebase, like a kitchen making different dishes from the same ingredients. Use them to manage separate API endpoints and branding for dev, staging, and prod.

Flutter & Dart30 sec read

Drift: Type-Safe SQL in Dart & Flutter

Drift gives your raw SQL queries compile-time safety. Instead of parsing maps, its build-time analyzer validates your SQL and generates typed Dart objects for results. Use it to write complex queries without risking runtime errors from typos or schema changes.

Flutter & Dart · Tezvyn