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 25

Flutter & Dart2 min read

How do you synchronize app state with GoRouter navigation?

Read auth state in top-level redirect; rebuild GoRouter via refreshListenable on changes; handle deep links in page builders.

Flutter & Dart2 min read

Flutter's Path Class: Drawing Custom Shapes

Flutter's Path is a digital pen for drawing any custom shape. Use it for complex icons, charts, or clipping widgets into non-rectangular forms. The footgun: forgetting moveTo will connect separate parts of your drawing with an unwanted line.

Flutter & Dart2 min read

Persist a custom Dart object using shared_preferences

Tests JSON serialization bridging custom objects to primitive-only key-value storage. Strong answer: add toJson/fromJson on User, jsonEncode into SharedPreferences as String, jsonDecode on read. Red flag: proposing direct storage or toString hacks.

Flutter & Dart2 min read

Flutter's Physics Simulations: The Simulation Class

Flutter's Simulation class is the engine for physics-based animations, modeling a 1D object's position and velocity over time. It powers realistic scrolling, springs, and gravity effects.

Flutter & Dart2 min read

Explain the difference between tester.pump and tester.pumpAndSettle

This tests your grasp of Flutter frame scheduling. pump draws one frame; pumpAndSettle loops until idle, failing on infinite animations. A red flag is treating pumpAndSettle as universally safe or missing why a loading spinner causes timeouts.

Flutter & Dart2 min read

Canvas Transformations: Moving the Paper, Not the Pen

Think of Flutter's Canvas transformations not as moving your drawing, but as moving the coordinate system itself. This is key for custom painters, like rotating the canvas to draw tick marks on a dial.

Flutter & Dart2 min read

Explain map() vs where() on a List and chain them

This tests Dart Iterable laziness and correct chaining. A strong answer states where filters and map transforms, both return Iterables, then chains where before map and converts with toList. A red flag is claiming the original list mutates or omitting toList.

Flutter & Dart2 min read

Flutter Packages: Bridging Dart to Native Features

Think of packages as pre-built bridges to native device features. They let your Dart code access the camera or GPS without you writing the complex, platform-specific code.

Flutter & Dart2 min read

Design an immutable UserSettings class with copyWith for Flutter state

Tests immutability as Flutter's state foundation. A great answer shows final fields, a const constructor, copyWith with nullable named params and null-aware fallback, and explains how immutability prevents accidental shared mutations during rebuilds.

Flutter & Dart2 min read

Flutter: Requesting Runtime Permissions

Don't assume your app has access to the camera or contacts; you must ask the user for permission at runtime. This is required for features like photo uploads or location tracking. The common footgun is forgetting to declare permissions in native config files.

Flutter & Dart1 min read

Dart reduce versus fold on collections

Reduce combines same-type elements and throws on empty; fold takes an initial value and accumulator of any type, safe on empty.

Flutter & Dart2 min read

Dart's Platform Class: Querying the Host Environment

Think of Dart's Platform class as a runtime detective for your app. It answers "where am I running?" by checking the OS, environment variables, and more. Use it to show different UI on iOS vs. Android.

Flutter & Dart2 min read

Riverpod providers are objects, not widgets. What are the practical advantages?

Tests architectural decoupling of state and UI in Flutter. Strong answers hit compile-time safety, unit testing without widget trees, and logic that survives outside BuildContext. Red flag: praising syntax sugar without explaining the coupling problem.

Flutter & Dart2 min read

Flutter Platform Channels: Talking to Native Code

Platform Channels are a telephone line between your Dart code and native device APIs. Use them to access features like battery level or integrate a native SDK not available in Dart.

Flutter & Dart2 min read

Design a BLoC solution for an API call that updates multiple UIs

Decoupled BLoC orchestration for multi-surface updates. Use a coordinator stream so each BLoC subscribes independently while keeping loading and error states local per widget. Directly nesting one BLoC inside another or using global variables for shared state.

Flutter & Dart2 min read

Structure a POST request to send a Dart object as JSON

Set Content-Type application/json, serialize to Map via toJson, encode with dart:convert jsonEncode, and pass the string as body.

Flutter & Dart2 min read

Platform Views: Embedding Native UI in Flutter

Platform Views cut a hole in your Flutter UI to show a native component. Use them to embed UI that can't be rebuilt in Dart, like Google Maps or a native WebView. Be warned: they are resource-heavy and can hurt performance if overused.

Flutter & Dart2 min read

Propose a Dart FFI approach to share camera frames and its risks

Tests zero-copy frame sharing via Dart FFI plus ownership and thread hazards. Propose native allocation, pass pointer to Dart as external TypedData, use ring buffer, then free; cite use-after-free and races.

Flutter & Dart2 min read

Pigeon: Type-Safe Platform Channels in Flutter

Pigeon acts like a contract for your app's native code, generating type-safe platform channels from a single definition. This replaces manual, error-prone MethodChannel code. The footgun: Swift types default to structs; use @SwiftClass for class features.

Flutter & Dart2 min read

Securely inject secrets for build flavors in CI/CD

Contrast CI environment variable injection with runtime secrets-manager fetches via CLI, comparing rotation overhead and blast radius.