Interview Questions • Mobile

15 Flutter Interview Questions & Answers (2026)

The most commonly asked Flutter and Dart interview questions with detailed answers. Covering widgets, state management, async programming, performance, and testing.

1. What is the difference between StatelessWidget and StatefulWidget?

StatelessWidget is immutable — it has no internal state and rebuilds only when its parent rebuilds with new data. Use it for UI that depends entirely on configuration passed in. StatefulWidget has a separate State object that persists across rebuilds and can call setState() to trigger a UI update. Use StatefulWidget when the widget needs to track user interaction, animations, or async data that changes over time.

2. Explain the Flutter widget tree, element tree, and render tree.

Flutter has three trees working together. The Widget tree is a blueprint — immutable descriptions of UI. When Flutter builds the widget tree, it creates a corresponding Element tree that holds the actual state and manages the widget's lifecycle. The Render tree handles layout and painting. On rebuild, Flutter reconciles the widget tree against the existing element tree and only updates what changed, similar to React's virtual DOM diffing.

3. What is the difference between hot reload and hot restart in Flutter?

Hot reload injects updated code into the running VM and rebuilds the widget tree while preserving the app's state (scroll position, form data, etc.). It's very fast and works for most UI changes. Hot restart restarts the app from scratch — it re-initializes state but is still faster than a full rebuild. Use hot reload during UI iteration; use hot restart when you change app initialization logic, providers, or main().

4. How does Flutter handle async operations? Explain Future and Stream.

Dart uses async/await for asynchronous code. A Future represents a single value that will be available at some point — like a network request. Use FutureBuilder in the widget tree to reactively build UI around a Future. A Stream is a sequence of async events over time — like a WebSocket or live database listener. Use StreamBuilder to reactively display stream data. Both integrate with async/await using the await keyword.

5. What are keys in Flutter and when do you need them?

Keys help Flutter identify widgets when the widget tree structure changes. Without keys, Flutter uses position to match old and new widgets. With keys, Flutter matches by key value. You need keys when you have a list of widgets with state (StatefulWidgets) that can be reordered — without keys, state gets associated with the wrong widget after reorder. GlobalKey also allows accessing the state of a widget from outside its subtree.

6. Explain the Bloc pattern in Flutter.

Bloc (Business Logic Component) separates UI from business logic using two streams: an input stream of Events (user actions) and an output stream of States (UI representations). The Bloc class maps events to states. This makes state transitions explicit and testable. Cubit is a simplified version of Bloc that uses methods instead of events, reducing boilerplate while keeping the same separation of concerns. Most enterprise Flutter apps use flutter_bloc package.

7. What are platform channels and how do you use them?

Platform channels allow Flutter Dart code to communicate with native Android (Kotlin/Java) and iOS (Swift/Objective-C) code. You set up a MethodChannel with a unique name, call methods from Dart using invokeMethod(), and register a handler on the native side. Use platform channels for device features Flutter doesn't support natively — Bluetooth, custom camera, health APIs. Plugins abstract this pattern for reusable solutions.

8. How do you optimize Flutter app performance?

Key optimizations: use const constructors for widgets that never change, avoid rebuilding expensive subtrees by splitting widgets and using Builder, use ListView.builder instead of ListView for long lists (lazy loading), minimize setState scope to the smallest widget needed, avoid doing heavy work in build(), use RepaintBoundary to isolate custom painters, and profile with DevTools Flame chart to find jank. Avoid 'overdraw' — painting the same area multiple times.

9. What is Navigator 2.0 in Flutter and why does it exist?

Navigator 1.0 used an imperative push/pop API. Navigator 2.0 introduces a declarative API using Router and RouterDelegate, where the navigation stack is derived from app state rather than manually managed. It was introduced to support web URLs, deep linking, and complex navigation flows that felt awkward with the imperative API. Most apps still use go_router or auto_route packages which wrap Navigator 2.0 in a more ergonomic API.

10. What is Riverpod and how does it differ from Provider?

Riverpod is created by the same author as Provider but fixes several limitations. Providers in Riverpod are declared globally (not in the widget tree) — removing the need to insert them above the widget that needs them. Riverpod has compile-time safety, eliminating ProviderNotFoundException at runtime. It supports asynchronous providers natively with AsyncValue. Riverpod is more testable because you can override any provider in tests without app structure changes.

11. How does Flutter handle different screen sizes and densities?

Flutter uses logical pixels — device-independent units that scale to screen density automatically. MediaQuery provides screen size, orientation, and density. LayoutBuilder lets widgets adapt to the available space. Use Flexible, Expanded, and FractionallySizedBox for responsive proportional layouts. For different form factors (phone vs tablet), use adaptive layouts that check MediaQuery.of(context).size.width and render different widget trees.

12. Explain isolates in Dart.

Dart is single-threaded but uses isolates for true parallelism. An isolate has its own heap and event loop — unlike threads, isolates don't share memory, which eliminates race conditions. Isolates communicate by passing messages through ports. Use compute() (which spawns an isolate) for heavy CPU work like JSON parsing large files or image processing, to avoid blocking the main UI thread. Dart 3 adds easier isolate spawning with Isolate.run().

13. What is the difference between const and final in Dart?

final means a variable can be set once and then is immutable — but its value is determined at runtime. const means the value is a compile-time constant — known at compile time and shared across instances. const widgets (like const Text('hello')) are built once and reused, which is a meaningful performance optimization in Flutter. Use const wherever possible for widgets and values that don't change.

14. How do you write unit tests and widget tests in Flutter?

Unit tests test pure Dart functions/classes with no Flutter dependency — use the test package. Widget tests test Flutter widgets in a simulated environment using WidgetTester — verify that widgets render correctly and respond to interactions without running on a real device. Integration tests run the full app on a real device or emulator. Use flutter_test for widget tests and mockito or mocktail for mocking dependencies. Bloc makes business logic especially easy to unit test.

15. What is BuildContext in Flutter?

BuildContext is a handle to the widget's location in the widget tree. Every widget's build() method receives a BuildContext that allows it to look up ancestors (Theme.of(context), Navigator.of(context), Provider.of(context)) and find inherited data. BuildContext is tied to the element in the element tree, not the widget. Never store a BuildContext for use after an async gap without checking mounted first, as the element might no longer exist.

Practice with AI mock interviews

Resumly's interview prep tool generates personalized Flutter questions based on your resume and gives AI feedback on your answers.

Start interview prep

More interview guides

Frequently Asked Questions

What topics are most important to study for a Flutter interview?

Focus on the widget tree and lifecycle, state management (Provider, Bloc, Riverpod), Dart's async/await and Futures, null safety, Navigator 2.0, platform channels, and performance optimization. Understanding how Flutter renders UI through the widget/element/render tree is fundamental and comes up in many forms.

How is Flutter different from React Native?

Flutter uses its own rendering engine (Skia/Impeller) and does not use native platform components — it draws every pixel itself, which gives consistent UI across platforms. React Native bridges JavaScript to native platform components using a JavaScript bridge (or the new JSI). Flutter generally offers better performance for animations and custom UI; React Native has a larger ecosystem and easier web integration.

Which state management solution should I know for Flutter interviews?

Know at least two state management approaches well. Provider/ChangeNotifier is the most beginner-friendly and commonly seen in smaller apps. Bloc/Cubit is popular in enterprise Flutter codebases because of its explicit event/state pattern. Riverpod is increasingly preferred for its compile-time safety and testability. Being able to explain why you'd choose one over the other shows senior-level thinking.

What is null safety in Dart?

Null safety (introduced in Dart 2.12) means variables cannot be null unless explicitly declared nullable with '?'. This moves null-related errors from runtime to compile time. Non-nullable types (String) must be initialized before use. Nullable types (String?) require null checks before use. The late keyword declares a non-nullable variable that will be initialized before first access.

How does Flutter handle animations?

Flutter has two levels of animations: implicit animations (AnimatedContainer, AnimatedOpacity) which automatically transition between values, and explicit animations using AnimationController with Tween for full control. Staggered animations, custom painters, and Rive/Lottie integrations handle more complex cases. Flutter's rendering at 60–120fps makes smooth animations possible when widgets are built efficiently.