Skip to content
tezvyn:

Flutter

294 bites tagged Flutter — interview questions with model answers, and 60-second explainers.

Flutter & Dart2 min read

Define a Dart Future, return Future<String>, and handle errors with both patterns.

Tests Dart async primitives and error handling. A strong answer defines Future as a pending async result, writes a delayed Future<String>, consumes it with then/catchError, and mirrors with async/await try/catch.

Flutter & Dart2 min read

How do you model Product and safely parse JSON into List<Product>?

Tests bridging dynamic JSON to Dart's type system. A strong answer uses an immutable Product with a factory constructor that validates fields and converts types, mapping over the list. Red flag: leaving everything dynamic or assuming perfect API data.

Flutter & Dart2 min read

What is a Dart factory constructor and common use cases?

Explain a factory need not create new instances and can return cached objects or subtypes; contrast with generative ones; give JSON or singleton examples. When Dart factories beat generative constructors.

Flutter & Dart2 min read

What are the key differences between Dart extends, implements, and with?

This tests your grasp of Dart's inheritance, interface, and mixin models. extends gives single inheritance; implements forces full reimplementation; with injects shared behavior.

Flutter & Dart2 min read

Difference between final and const Dart class properties?

This tests your grasp of Dart's compile-time versus runtime constant model. A strong answer contrasts final variables set once with static const compile-time values, notes const is implicitly final, gives examples. Red flag: const as non-static instance field.

Flutter & Dart2 min read

Convert List<User> to Map<String, User> keyed by user id

Tests Dart collection-to-map idioms. A strong answer picks the for-element literal {for (var u in users) u.id: u}, mentions Map.fromIterable as a verbose alternative, and flags duplicate-key overwrites. Red flag: manually looping to populate an empty map.

Flutter & Dart2 min read

Explain Dart switch exhaustiveness for enums versus sealed classes

This tests Dart 3 exhaustiveness. A strong answer notes that enums and sealed classes both require exhaustive switches, but sealed classes allow distinct payloads because subclasses stay in the same library. A red flag is calling them just enums with methods.

Flutter & Dart2 min read

How do you use collection-if and collection-for to declaratively build a list?

Tests Dart's declarative collection control-flow features. Answer: show collection-for to filter inside a literal, collection-if for conditional items, and combine both in one expression. Red flag: imperative loops and add() instead of literal syntax.

Flutter & Dart2 min read

What problem does late solve in Dart?

Tests definite assignment and lazy init in null-safe Dart. Strong answers cover: deferred non-nullable field init, lazy final evaluation, and LateInitializationError on early access. Red flag: treating late as nullable or saying it bypasses null safety.

Flutter & Dart2 min 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 & Dart2 min read

Explain Dart positional vs named parameters and write one signature

Tests Dart parameter syntax. A strong answer covers required positional args, optional positional args in square brackets, and named args in curly braces with defaults. Red flag: claiming named parameters are always optional or confusing bracket types.

Flutter & Dart2 min read

What is the difference between final and const in Dart?

Tests compile-time versus runtime immutability in Dart. A strong answer: final allows single assignment at runtime, but const requires a compile-time constant and deep immutability.

Flutter & Dart2 min read

Flutter Performance Overlay

Flutter's Performance Overlay is a real-time EKG for frame budgets. Two graphs reveal whether Dart UI work or GPU rasterization is causing jank during animations. The footgun is rewriting widget logic when the raster thread is actually the bottleneck.

Flutter & Dart2 min read

Tree Shaking Removes Unused Flutter Code

Tree shaking is the compiler deleting code your app never calls, so importing a massive package only costs the pieces you use. It runs automatically in release builds. Relying on dynamic dispatch or dart:mirrors silently disables it and brings back the bloat.

Flutter & Dart2 min read

Legacy Integration Testing with flutter_driver

flutter_driver remotely pilots your app from a host via Dart VM service, common in legacy codebases with host-side scripts. Do not treat it as an in-process widget test because it runs outside the app; you cannot inspect state or use flutter_test matchers.

Flutter & Dart2 min read

Repository Pattern: Hide Your Data Sources

A repository is a contract that hides where your data lives. Your Flutter app should not care if a user profile comes from Firebase, SQLite, or a mock. Engineers often leak HTTP clients or database models into UI instead of returning domain models.

Flutter & Dart2 min read

Flutter Network Errors: Fail Gracefully

Treat every network call as a promise that might break. In Flutter, catch exceptions at the HTTP boundary and map them to UI states like retry widgets. The footgun is letting Dio or http exceptions bubble up, crashing the app instead of degrading gracefully.

Flutter & Dart2 min read

Full-Text Search in Local Flutter Databases

SQLite FTS5 is an inverted index in your app: words map to row IDs, skipping brute-force scans. Use it when local tables exceed thousands of rows and LIKE lags. The footgun is that FTS virtual tables never auto-sync, so stale indexes return wrong rows.

Flutter & Dart2 min read

Passing Arguments to Flutter Named Routes

Flutter named routes pass data through an arguments field instead of global variables. Use this when navigating to a route that needs an ID or configuration object. Arguments are untyped by default, so unsafe casts crash at runtime.

Flutter & Dart2 min read

Performance Profiling in Tests

Performance profiling in tests means capturing frame build and raster times during a scripted, automated run instead of eyeballing smoothness, so jank regressions get caught in CI before they ever reach a real device.

Flutter & Dart2 min read

Flutter Nested Navigation: Routers Within Routers

Nested Navigation is like having a mini-app with its own back button inside a single screen. It's used for UIs like a BottomNavigationBar where each tab needs its own navigation history. The footgun is calling the wrong Navigator's context.

Flutter & Dart2 min read

Flutter's `compute`: Offload Heavy Work from the UI Thread

Flutter's `compute` function runs heavy calculations in the background to prevent your app's UI from freezing. Use it for tasks like parsing large JSON or complex math. The footgun: on the web, it runs on the same event loop, not in a true parallel thread.

Flutter & Dart2 min read

Flutter for Web: Build and Deploy

Flutter for Web compiles your Dart code into a web app. Use `flutter build web` and choose a renderer: HTML for smaller size or CanvasKit for performance. The footgun is the initial download size, which can be large and slow down first-page load.

Flutter & Dart2 min read

Generating Code Coverage Reports in Dart

Code coverage shows which lines your tests execute. It's a health check for your test suite's reach, not a measure of code quality. Use the `coverage` package to generate reports for CI/CD. The footgun is that high coverage doesn't prove correctness.

Get Flutter bites daily.

Five a day, five minutes, offline. With quizzes so it sticks.

Open testing — you’ll join as an early tester.