Autocoder

Flutter Interview Questions and Answers (Flutter 3, Dart 3)

Last updated 2026-11-19

Flutter interviews test whether you understand how the framework turns widgets into pixels and how to keep state predictable as an app grows. Questions cover the widget, element and render trees, stateless versus stateful widgets, keys, state management with Provider, Riverpod or Bloc, asynchronous Dart and the performance habits that keep scrolling at a smooth frame rate.

The answers use Flutter 3 and Dart 3, including records, patterns and sealed classes. Compare approaches on the Android, iOS and React Native pages. If your round includes a build task, how to crack a take-home assignment is a useful guide.

Version coveredFlutter 3.x, Dart 3.x
Core topicsWidgets, three trees, state management, async Dart, performance, platform integration
Questions here17

Dart 3 features worth knowing

How interviewers probe state management

They rarely require one specific library. They want you to explain where state lives, how widgets listen to it, how rebuilds are limited and how you would test the logic. Pick one approach, such as Riverpod or Bloc, and be able to compare it honestly with another and with plain setState for small screens.

Flutter Interview Questions and Answers (Flutter 3, Dart 3): questions with worked answers

  1. 1

    What is the difference between StatelessWidget and StatefulWidget?

    easy

    A StatelessWidget is immutable: its output depends only on its constructor arguments and the inherited data it reads. A StatefulWidget creates a separate State object that lives across rebuilds and holds mutable data, and you call setState to schedule a rebuild. The widget itself is recreated often and is cheap, while the State object persists. Use stateless wherever you can.

    dart
    class Counter extends StatefulWidget {
      const Counter({super.key});
      @override
      State<Counter> createState() => _CounterState();
    }
    
    class _CounterState extends State<Counter> {
      int _n = 0;
      @override
      Widget build(BuildContext context) =>
          TextButton(onPressed: () => setState(() => _n++), child: Text('Tapped $_n'));
    }
  2. 2

    What does "everything is a widget" mean?

    easy

    Layout, styling, gestures and even padding are expressed as widgets composed into a tree, so you build complex UI from small pieces instead of configuring one large component. Widgets are lightweight, immutable descriptions of part of the UI, not the objects that draw it. Composition is preferred over inheritance when you build your own widgets.

  3. 3

    Explain the widget tree, element tree and render tree.

    medium

    Widgets describe configuration and are rebuilt often. Elements are the live instances that sit in the tree, hold the State and decide whether to update an existing render object or replace it by comparing the new widget's runtimeType and key with the old. RenderObjects perform layout and painting. This split is why rebuilding widgets is cheap: only changed render objects are touched.

  4. 4

    What are keys and when do you need them?

    medium

    A key helps Flutter match widgets with their elements when they move within a list of the same type. Without keys, reordering stateful items can attach state to the wrong item, since matching is by type and position. Use ValueKey for items with a stable id, ObjectKey for object identity, UniqueKey to force a new state, and GlobalKey to access a State from elsewhere, sparingly.

    dart
    ListView(
      children: [
        for (final t in todos) TodoTile(key: ValueKey(t.id), todo: t),
      ],
    )
  5. 5

    What is BuildContext?

    medium

    BuildContext is a handle to a widget's location in the element tree. You use it to look up inherited widgets such as Theme.of(context) or Navigator.of(context), by walking up from that location. A common bug is using a context from above a Scaffold or after an await when the widget may be unmounted, so check context.mounted before using it after an async gap.

    dart
    onPressed: () async {
      await save();
      if (!context.mounted) return;
      Navigator.of(context).pop();
    },
  6. 6

    Describe the State lifecycle.

    medium

    createState creates the State object, initState runs once for setup, didChangeDependencies runs after initState and when an inherited widget changes, build runs on every rebuild, didUpdateWidget runs when the parent supplies a new widget configuration, and dispose runs when the State is removed permanently. Subscribe in initState and always cancel streams, controllers and timers in dispose.

  7. 7

    How do you choose a state management approach?

    medium

    Use setState for state local to one widget. Lift state up or use InheritedWidget for small trees. For app-wide or shared state use a library: Provider or Riverpod for dependency and state exposure, Bloc or Cubit for event-driven, testable logic. Pick one that your team knows, keep business logic out of widgets, and expose immutable state so rebuilds are predictable.

    dart
    final counterProvider = NotifierProvider<CounterNotifier, int>(CounterNotifier.new);
    
    class CounterNotifier extends Notifier<int> {
      @override
      int build() => 0;
      void increment() => state++;
    }
    // ref.watch(counterProvider) in a ConsumerWidget
  8. 8

    Future, async and await, and Stream in Dart?

    medium

    A Future represents one value that arrives later, and async with await lets you write it sequentially. A Stream delivers a sequence of values over time, consumed with await for or listen. Dart is single-threaded per isolate with an event loop, so async code interleaves but does not run in parallel. Use FutureBuilder and StreamBuilder to build UI from them, creating the future outside build so it is not restarted on each rebuild.

  9. 9

    What are isolates and when do you use them?

    medium

    An isolate is an independent worker with its own memory and event loop, communicating only by messages, so there are no shared-memory data races. Heavy CPU work such as parsing a large JSON or processing an image blocks the UI isolate and drops frames. Use Isolate.run, or the compute helper, to run a function on another isolate and return the result.

    dart
    final parsed = await Isolate.run(() => jsonDecode(hugeString) as Map<String, dynamic>);
  10. 10

    How do you build long lists efficiently?

    medium

    Use ListView.builder or SliverList with a delegate so items are created only as they scroll into view, and give itemExtent or prototypeItem when heights are fixed so layout is cheap. Do not use a Column with hundreds of children inside a scroll view. Use const constructors, avoid expensive work in item builds and paginate data.

    dart
    ListView.builder(
      itemCount: items.length,
      itemBuilder: (context, i) => ProductTile(key: ValueKey(items[i].id), product: items[i]),
    )
  11. 11

    Why use const constructors?

    medium

    A const widget is created once at compile time and reused, and Flutter can skip rebuilding the subtree beneath an identical const instance. It reduces allocation and rebuild work. The analyzer lint prefer_const_constructors helps. It only works when all arguments are compile-time constants.

  12. 12

    How do you navigate between screens?

    medium

    Navigator pushes and pops routes imperatively, and the Router API with go_router, the officially supported package, offers declarative, URL-based routing with deep links, redirects and nested navigation, which also helps on the web. Pass data through route parameters or extra, and for results use the value returned by push. Guard routes with redirect logic.

  13. 13

    How would you reduce unnecessary rebuilds?

    hard

    Make the rebuilt subtree small: split big build methods into separate widgets, so setState or a listener rebuilds only what changed. Use const widgets, select a slice of state with context.select or ref.watch with select, and avoid creating new objects in build that break equality. Profile with DevTools rebuild tracking before optimising, in profile mode on a real device, not debug.

  14. 14

    What is Impeller?

    hard

    Impeller is Flutter's rendering engine that replaces Skia on iOS, where it is the default, and on current Android versions. It precompiles shaders ahead of time, which removes the first-run shader compilation jank that earlier versions suffered. Interviewers ask this to see whether you track the engine. The framework API you write against does not change.

  15. 15

    How does Flutter talk to native code?

    hard

    Platform channels pass asynchronous messages between Dart and Kotlin, Java or Swift code: MethodChannel for method calls, EventChannel for streams. Pigeon generates type-safe interfaces, and dart:ffi calls C libraries directly. Wrap native features in a plugin with a federated structure per platform, and handle missing implementations on platforms you do not support.

  16. 16

    What do records, patterns and sealed classes give you in Dart 3?

    hard

    Records return several values without a class, patterns destructure them and objects, and sealed classes define a closed set of subtypes so that a switch expression must handle every case, or the compiler reports an error. Together they model UI states cleanly, such as loading, data and error, without nullable fields.

    dart
    sealed class ViewState {}
    class Loading extends ViewState {}
    class Loaded extends ViewState { final List<Item> items; Loaded(this.items); }
    class Failed extends ViewState { final String message; Failed(this.message); }
    
    Widget render(ViewState s) => switch (s) {
      Loading() => const CircularProgressIndicator(),
      Loaded(:final items) => ItemList(items: items),
      Failed(:final message) => Text(message),
    };
  17. 17

    How do you test a Flutter app?

    hard

    Unit tests cover plain Dart logic, widget tests render a widget with testWidgets, interact through the WidgetTester and assert on the finder results, and integration tests run on a device or emulator through integration_test. Golden tests compare rendered images. Inject dependencies, so fakes replace network and storage, and use mocktail or hand-written fakes.

    dart
    testWidgets('increments', (tester) async {
      await tester.pumpWidget(const MaterialApp(home: Counter()));
      await tester.tap(find.byType(TextButton));
      await tester.pump();
      expect(find.text('Tapped 1'), findsOneWidget);
    });

Frequently asked questions

Do I need to know Dart before Flutter interviews?

Yes. Expect questions on null safety, async programming, isolates, mixins and the Dart 3 features such as records and sealed classes.

Which state management library should I learn?

Pick Riverpod or Bloc and know it well, and be able to explain Provider and setState and when each fits.

Is Flutter used for production apps in India?

Yes, many startups and some large companies use Flutter, so openings exist for cross-platform developers, though the volume varies by city and year.

How is Flutter different from React Native?

Flutter draws its own UI with its own engine and Dart, while React Native renders native components from JavaScript or TypeScript.

Related guides

More in Role-wise Interview Questions by Job and Tech Stack

See all in this section