Flutter and Dart Interview Questions and Answers

Flutter interviews usually test three things: how well you know Dart, whether you understand how the widget tree actually renders, and how you keep state under control as an app grows. The questions below follow that order and finish with practical scenarios.

52 questions with answersLevels: Fresher to SeniorUpdated November 2026

Dart basics

Language questions that open most Flutter interviews.

Q1.What is Dart and why does Flutter use it?

Dart is a typed, object-oriented language from Google. It compiles ahead of time to native machine code for fast release builds and just in time during development for hot reload. Its single-threaded event loop and garbage collector suit UI work.

Q2.How does sound null safety work in Dart?

Types are non-nullable by default. Add ? to allow null, use ! to assert non-null, ?? for defaults and ?. for safe access. Because it is sound, the compiler can rely on non-null types and optimise.

Q3.What is the difference between final and const?

final is set once at runtime. const is a compile-time constant, and const objects are canonicalised, so two identical const widgets share one instance. Const widgets also let Flutter skip rebuilding them.

Q4.What are late variables?

late declares a non-nullable variable that will be initialised after declaration, or lazily on first access if it has an initialiser. Accessing it before assignment throws an error.

Q5.What is the difference between Future and Stream?

A Future gives one value or error later, such as an HTTP response. A Stream gives a sequence of values over time, such as location updates or WebSocket messages.

Q6.How do async and await work in Dart?

An async function returns a Future. await pauses that function until the Future completes, without blocking the event loop, so the UI keeps running.

Q7.What are mixins?

A mixin adds methods and fields to a class without inheritance, using with. Flutter uses them a lot, for example SingleTickerProviderStateMixin for animation controllers.

Q8.What are extension methods?

They add methods to existing types, such as extension on String { bool get isEmail => ... }. They are resolved statically on the declared type.

Q9.What are records and patterns in Dart 3?

Records are lightweight anonymous types like (int, String) for returning multiple values. Patterns let you destructure them and match on shapes in switch statements, and sealed classes make those switches exhaustive.

Q10.What is the event loop in Dart?

Dart runs code on a single thread with a microtask queue and an event queue. Microtasks run first, then events like timers, I/O and taps. Long synchronous work blocks both, which is why heavy work moves to isolates.

Q11.What is an isolate?

An isolate is an independent Dart worker with its own memory and event loop. Isolates do not share memory and talk through messages. Isolate.run() or compute() move heavy work such as large JSON parsing off the UI isolate.

Q12.What is the difference between a List, Set and Map in Dart?

A List is an ordered collection that allows duplicates. A Set holds unique values with fast lookups. A Map stores key-value pairs. Collection if, collection for and the spread operator ... make building them in widget trees easy.

Q13.What are named and optional parameters?

Parameters in curly braces are named and optional unless marked required. Parameters in square brackets are optional positional. Flutter widgets use named parameters heavily, which makes constructors readable.

Q14.What is a factory constructor?

A constructor marked factory does not always create a new instance. It can return a cached object or a subtype, and it is commonly used for fromJson constructors.

Widgets and rendering

How Flutter builds and draws the UI.

Q15.What is the difference between StatelessWidget and StatefulWidget?

A StatelessWidget depends only on its constructor arguments. A StatefulWidget has a separate State object that persists across rebuilds and can call setState to rebuild.

Q16.What does setState do?

It marks the State's element as dirty so Flutter rebuilds that widget on the next frame. It should only wrap the state change, and calling it after dispose throws an error, so check mounted after async gaps.

Q17.Explain the widget, element and render object trees.

Widgets are immutable configurations and cheap to recreate. Elements are the long-lived instances that hold the place in the tree and link widgets to state. Render objects do layout and painting. Rebuilding creates new widgets, but elements and render objects are reused when the type and key match.

Q18.What is BuildContext?

BuildContext is a handle to a widget's element and its position in the tree. It is used to look up ancestors such as Theme, MediaQuery, Navigator and inherited providers.

Q19.What are keys and when do you need them?

Keys help Flutter match widgets to existing elements when the order of siblings changes. Use ValueKey or ObjectKey on list items that can be reordered, removed or inserted, or state ends up attached to the wrong item. GlobalKey gives access to a widget's state from anywhere but is expensive.

Q20.What is the State lifecycle?

createState, initState once, didChangeDependencies when inherited data changes, build many times, didUpdateWidget when the parent rebuilds with a new configuration, deactivate and finally dispose, where you release controllers and subscriptions.

Q21.What is an InheritedWidget?

A widget that efficiently passes data down the tree. Descendants that depend on it rebuild when it changes. Theme, MediaQuery and the Provider package are built on it.

Q22.How does layout work in Flutter?

Constraints go down, sizes go up, the parent sets position. Each parent gives its child minimum and maximum width and height, the child picks a size inside them, and the parent places it.

Q23.Why do you get a RenderFlex overflowed error?

A Row or Column's children need more space than available. Fix it with Expanded or Flexible, wrapping in a scroll view, or limiting text with overflow and maxLines.

Q24.What is the difference between Expanded and Flexible?

Both share free space in a Row or Column by flex factor. Expanded forces the child to fill its share, while Flexible lets the child be smaller than its share.

Q25.How do you build lists efficiently?

Use ListView.builder or slivers so only visible items are built. Give items fixed extents or prototype items where possible, and avoid building heavy widgets up front with the default ListView constructor for long lists.

Q26.What is the difference between hot reload and hot restart?

Hot reload injects changed code and rebuilds the widget tree while keeping state. Hot restart restarts the app and resets state. Changes to main, global initialisers or native code need a restart or full rebuild.

Q27.What is Impeller?

Impeller is Flutter's rendering engine that replaced Skia as the default on iOS and on modern Android devices. It compiles shaders ahead of time, removing the first-run shader compilation jank.

Q28.What is the difference between MaterialApp and CupertinoApp?

MaterialApp sets up Material Design theming, navigation and localisation. CupertinoApp does the same with iOS-style widgets. Many apps use Material everywhere and swap only selected widgets with .adaptive constructors.

Q29.How do animations work in Flutter?

Implicit animations such as AnimatedContainer and AnimatedOpacity animate between values automatically. Explicit animations use an AnimationController with a ticker, tweens and curves for full control. Hero animates shared elements between routes.

Q30.What are slivers?

Slivers are scrollable pieces used inside a CustomScrollView, such as SliverAppBar, SliverList and SliverGrid. They allow effects like collapsing headers and mixing lists and grids in one scroll.

State management and architecture

Questions for mid-level and senior Flutter roles.

Q31.What is the difference between ephemeral and app state?

Ephemeral state belongs to one widget, like the current tab or a text field, and setState is fine for it. App state is shared, such as the logged-in user or cart, and needs a state management solution.

Q32.Compare Provider, Riverpod and Bloc.

Provider wraps InheritedWidget with a simple API. Riverpod is from the same author, does not depend on BuildContext, catches errors at compile time and handles async state well. Bloc uses events and states with streams, giving strict separation and strong testing, at the cost of more boilerplate.

Q33.How do you structure a large Flutter app?

Organise by feature, each with presentation, application or domain, and data layers. Repositories wrap APIs and local storage, state classes expose immutable state, and dependency injection wires it together.

Q34.How do you navigate in Flutter?

Navigator with push and pop for simple apps. For deep links, web URLs and nested navigation, use the Router API through a package such as go_router.

Q35.How do you call native platform code?

Use platform channels. A MethodChannel sends method calls between Dart and Kotlin or Swift, an EventChannel streams events. Pigeon generates type-safe channel code. For C libraries, use dart:ffi.

Q36.How do you handle JSON serialisation?

For small models, write fromJson and toJson by hand. For larger apps, use json_serializable or freezed with build_runner to generate the code and immutable data classes.

Q37.How do you store data locally?

shared_preferences for small settings, flutter_secure_storage for tokens, and a database like sqflite, Drift, Isar or Hive for structured data.

Q38.What kinds of tests does Flutter support?

Unit tests for logic, widget tests that pump a widget in a fake environment and check the tree, and integration tests with the integration_test package that run on a device or emulator. Golden tests compare widget screenshots.

Q39.How do you support multiple flavors and environments?

Define flavors in Gradle and Xcode schemes, use separate entry points or --dart-define values for API URLs and keys, and pass the flavor when building.

Q40.What is freezed and why do people use it?

freezed is a code generator for immutable data classes with copyWith, equality, toString and union types. It pairs well with Riverpod and Bloc for state classes.

Q41.How do you handle errors globally?

Set FlutterError.onError for framework errors and PlatformDispatcher.instance.onError for uncaught async errors, and forward both to a crash reporter like Crashlytics or Sentry. Show friendly error widgets with ErrorWidget.builder in release builds.

Performance and scenarios

Practical problems you may be asked to solve.

Q42.How do you find jank in a Flutter app?

Run in profile mode on a real device, open DevTools and check the performance view for frames over the budget. Look at whether the UI thread or raster thread is slow and use the timeline to find the expensive build or paint.

Q43.How do you reduce unnecessary rebuilds?

Use const constructors, split big widgets into smaller ones, select only the needed part of state (for example with select in Riverpod or context.select in Provider), and avoid putting heavy logic in build.

Q44.A large JSON response freezes the UI. What do you do?

Parse it in a background isolate with Isolate.run() or compute(), ask the API for pagination, and cache the parsed data.

Q45.An image-heavy grid uses too much memory. How do you fix it?

Request images at display size, use cacheWidth and cacheHeight to decode smaller, use cached_network_image for disk caching and build items lazily with GridView.builder.

Q46.You get a 'setState called after dispose' error. Why and how do you fix it?

An async operation finished after the widget left the tree. Check if (!mounted) return; after awaits, cancel subscriptions and timers in dispose, or move the work to a state management layer that outlives the widget.

Q47.How would you add a feature that needs a native SDK with no Flutter plugin?

Check pub.dev first. If nothing fits, write a plugin or use a MethodChannel in the app, wrapping the SDK in Kotlin and Swift with a small Dart API, and generate the interface with Pigeon.

Q48.How do you reduce Flutter app size?

Build with --split-per-abi or upload an app bundle, use --obfuscate and --split-debug-info, remove unused packages and assets, compress images and check size with --analyze-size.

Q49.How would you make a Flutter app accessible?

Use Semantics widgets for custom controls, label icons and images, support text scaling without overflow, keep tap targets at least 48 logical pixels, and test with TalkBack and VoiceOver.

Q50.How do you handle form validation?

Wrap fields in a Form with a GlobalKey<FormState>, give each TextFormField a validator, call validate() on submit and show errors inline. Keep validation rules in testable functions.

Q51.How do you implement localisation?

Use the flutter_localizations package and the gen-l10n tool with ARB files per language. Access strings through the generated AppLocalizations class and test right-to-left layouts with Directionality.

Q52.How do you handle app lifecycle events like going to background?

Use AppLifecycleListener or WidgetsBindingObserver to listen for resumed, inactive, hidden, paused and detached states, then pause media, save drafts or refresh data accordingly.

How to prepare for the interview

  • Be clear on the three trees: widgets, elements and render objects. Many follow-up questions depend on it.
  • Pick one state management approach you have shipped with (Riverpod, Bloc or Provider) and know its trade-offs.
  • Expect a live task building a list screen with an API call, loading and error states.
  • Know how to profile with Flutter DevTools and what jank looks like on the performance overlay.