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 23
Cross-Platform WebSockets with `web_socket_channel`
The web_socket_channel package abstracts away platform differences for WebSockets, giving you a single API for web, mobile, and server. Use it for real-time features like chat or live data feeds. The footgun: always await channel.ready before sending data.
Flutter's Widget, Element, and RenderObject trees: roles and relationships
Tests your mental model of Flutter's rendering layers. Strong answer: Widget is immutable configuration; Element is the mutable lifecycle manager owning the RenderObject; RenderObject is the concrete layout and paint entity.
shared_preferences for Simple On-Device Storage
shared_preferences is Flutter's go-to for simple on-device key-value storage, like a persistent dictionary for user settings. Use it to save a dark mode toggle or high score. Crucially, writes are not guaranteed, so don't use it for critical data.
Walk me through Flutter's rendering pipeline and its phases.
Tests your understanding of the three-tree separation and how changes become pixels. Outline: setState marks objects dirty; Build updates elements, Layout computes sizes bottom-up via constraints, and Paint records commands top-down into layers.
path_provider: Find Platform-Specific File Paths
path_provider asks the OS for standard file paths instead of you guessing. Use it to find the correct documents, temp, or cache directories on any platform. The footgun: not all paths exist on all systems, so always check for null returns.
Isolating and reducing excessive widget rebuilds
Push state down, use const subtrees, rebuild only listeners with ValueListenableBuilder, isolate repaints with RepaintBoundary.
Reading and Writing Files in Dart
Treat files as either a single string for simple cases or a stream of data for large ones. Use dart:io for saving user settings or processing logs. The main footgun is using synchronous methods like readAsStringSync, which can freeze your app.
Which DevTools view diagnoses janky Flutter animations?
Open Performance view; compare UI and Raster bars; flag bars over 16ms; blame UI bloat on builds and Raster jank on shaders or saveLayer.
sqflite: Local SQL Databases in Flutter
sqflite gives your Flutter app a private, on-device SQL database by wrapping the native SQLite engine. Use it for storing structured local data, like to-do lists or settings. The footgun: all database operations are async, so you must await every call.
Explain 'constraints go down, sizes go up, parent sets position.'
Tests Flutter layout protocol and unbounded width errors. Strong answers trace how a child gets infinite width from a scrolling parent and fix it with a bounded wrapper. Red flag: blaming the child without tracing parent constraints.
Hive: A Fast, Local Key-Value Store for Dart
Hive is a lightweight key-value database for Dart, acting like a persistent, super-fast Map. Use it to store simple data like user settings or cache API responses locally.

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_secure_storage: Secure Key-Value Pairs
flutter_secure_storage is your go-to for saving sensitive data like API tokens. Think of it as an encrypted, cross-platform key-value store that uses native Keychain on iOS and strong ciphers on Android. The footgun: it's slower and meant only for secrets.
When would you implement a CustomPainter and how does shouldRepaint work?
Use CustomPainter for charts; check fields in shouldRepaint to skip frames; pass Listenable to bypass build layout.
Drift Schema Migrations: Evolving Your Database Safely
Think of schema migrations as a recipe for upgrading your app's database from an old version to a new one. You'll use them whenever you add a table or column in Drift. The footgun is forgetting to bump schemaVersion; your migration won't run.
What is Flutter tree shaking and how does it reduce app size?
Tests Dart AOT dead code elimination. Covers compile-time dead code removal, smaller binaries, faster startup, and practices like avoiding dart:mirrors and using const constructors. Red flag: confusing it with minification or runtime stripping.

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.
How would you implement debounce for a search input using Streams?
This tests Stream transformation and event throttling. A strong answer outlines a resetting timer that only emits after 300ms of silence, referencing debounceTime or DebounceStreamTransformer. Red flag: manual Timer juggling without Stream composition.
Isar: A Modern NoSQL Database for Flutter Apps
Isar is a fast, local NoSQL database for Flutter, offering static typing and ACID guarantees. Use it for on-device persistence in iOS, Android, and desktop apps. Don't mistake it for a remote database; Isar is for local storage, not cloud sync.
What is a Dart Completer and when should you use it?
This tests bridging callback APIs into Dart's Future ecosystem. An answer defines Completer as a manual Future producer, explains completing with value or error from callbacks, preferring Future() when possible. A red flag is using Completer for simple async.