Advanced Flutter Interview Questions
23 questions
How does Flutter manage memory, and how do you avoid leaks?
Dart uses automatic garbage collection, so you don't free memory manually — leaks in Flutter almost always come from long-lived objects (controllers, streams, listeners) holding references that prevent disposed widgets' resources from being collected.
What is Firebase Remote Config used for?
Remote Config lets you change app behavior and appearance — feature flags, A/B test variants, default values — without shipping a new app release, by fetching key/value parameters from the Firebase backend at runtime.
What is Dependency Injection and how is it used in Flutter?
Dependency Injection means a class receives its dependencies from the outside (via constructor or a container) instead of creating them itself, which decouples classes from concrete implementations and makes them easy to test with substitutes.
What are isolates in Dart and when do you need them?
An isolate is Dart's unit of concurrency — a separate memory heap and event loop running independently, with no shared mutable state — used to run CPU-heavy work in parallel without blocking the UI thread.
What is CustomPainter used for?
CustomPainter lets you draw directly onto a canvas with low-level drawing primitives (paths, arcs, text, gradients) for visuals that no combination of standard widgets can produce — charts, custom shapes, signature pads.
What are platform channels and why are they needed?
Platform channels are Flutter's message-passing bridge to native platform code (Kotlin/Java on Android, Swift/Objective-C on iOS) — used whenever you need a platform API or native SDK that has no Dart equivalent.
What is InheritedWidget and how does it enable state propagation?
InheritedWidget lets data be efficiently passed down the widget tree without manually threading it through every constructor, and it's the low-level mechanism Provider, Theme, and MediaQuery are all built on.
What are Slivers in Flutter and when would you use CustomScrollView?
Slivers are scrollable areas that can be composed together inside a CustomScrollView, letting you mix different scroll behaviors — like a collapsing app bar, a grid, and a list — into one continuous scrollable, which a single ListView or GridView can't do.
What is a Completer in Dart and when would you use one?
A Completer lets you manually create and control a Future, resolving it later with .complete() or .completeError() — useful for wrapping callback-based APIs into a Future-based one.
What are Zones in Dart used for?
A Zone is an execution context that lets you intercept and customize behaviors like error handling, print output, and timers for all code running within it — most commonly used to catch otherwise-uncaught async errors app-wide.
What are async* generator functions in Dart?
An async* function is a generator that returns a Stream instead of a Future, letting you yield multiple values over time using the same imperative, sequential-looking code style as a normal async function.
What's the difference between Navigator 1.0 and Navigator 2.0?
Navigator 1.0 is imperative — you push/pop routes as commands; Navigator 2.0 is declarative — you describe the current stack of pages as a list derived from app state, which is what enables deep linking and browser back-button support to work correctly.
How does deep linking work in Flutter?
Deep linking means the OS can open your app directly to a specific screen from an external URL or link tap, requiring platform-level configuration (Android intent filters, iOS Universal Links) in addition to in-app routing logic mapping the incoming URL to the right screen.
How do you implement nested navigation in Flutter (e.g. a bottom nav bar with separate stacks per tab)?
Give each tab its own Navigator with a unique key, so each tab maintains an independent back stack, and wrap it in an IndexedStack to preserve each tab's state when switching between them.
What are golden tests in Flutter?
Golden tests render a widget and compare a screenshot of it pixel-for-pixel against a previously-approved reference image ('golden file'), catching unintended visual regressions that logic-based widget tests can't detect.
What are sealed classes in Dart and how do they enable exhaustive pattern matching?
A sealed class restricts which classes can extend/implement it to only those defined in the same library, letting the compiler verify a switch statement handles every possible subtype — catching missing cases at compile time instead of runtime.
How does GetX's Obx widget know when to rebuild?
Obx subscribes to any .obs observable read inside its builder function during the build — it tracks reads via a global tracking mechanism, rather than requiring you to explicitly declare which values it depends on.
What is ProxyProvider used for in the Provider package?
ProxyProvider lets you create a provider whose value depends on one or more other providers above it — for example, building a repository that needs an already-provided API client.
How do SOLID principles apply to Flutter development?
SOLID principles apply the same way they do in any OOP codebase — widgets, repositories, and use cases are the concrete places you apply them: single-responsibility widgets, interfaces for repositories (dependency inversion), and small, focused classes over sprawling ones.
How does MVVM compare to Clean Architecture in Flutter?
MVVM (Model-View-ViewModel) is primarily about separating presentation logic from UI; Clean Architecture is a broader, layered approach that MVVM can actually live inside as the presentation layer's specific pattern.
What's the difference between a DTO, a Model, and an Entity in Clean Architecture?
An Entity is a pure business object living in the domain layer with no knowledge of JSON or databases; a Model (or DTO) lives in the data layer, knows how to (de)serialize from a specific data source, and gets converted into an Entity before crossing into the domain layer.
What does RepaintBoundary do and when should you use it?
RepaintBoundary isolates its child into a separate compositing layer, so repainting that subtree doesn't force everything around it to repaint too — useful for expensive-to-paint widgets that change independently, but overusing it wastes memory on unnecessary layers.
How do Firebase Remote Config and A/B Testing work together?
Remote Config supplies the actual parameter values your app reads at runtime; Firebase A/B Testing sits on top of it, automatically assigning users to different Remote Config parameter variants and measuring which performs better against a chosen metric.