Flutter Developer interview questions
100 real questions with model answers and explanations for Junior Flutter Developer candidates.
See a Flutter Developer resume example →Practice with flashcards
Spaced repetition · Hunter Pass
Questions
They differ in when the type is chosen and how much static checking Dart performs.
- var infers one static type from the initializer, so var count = 1 cannot later hold a String.
- Object accepts any non-null Dart object, while Object? also accepts null, but both require type checks before member access.
- dynamic defers member and assignment checks until runtime, so I keep it at untyped boundaries and convert it quickly.
Why interviewers ask this: The interviewer checks whether you can use Dart's type system without casually disabling null safety or static checks.
final is assigned once at runtime, while const represents a compile-time constant.
- A final value may come from DateTime.now() or an API response, but it cannot be reassigned afterward.
- A const value and everything inside its constant collection must be known at compile time.
- const widget instances can be canonicalized and reused, so I use const constructors where all arguments are constant.
Why interviewers ask this: A strong answer distinguishes single assignment from compile-time constancy and connects const to Flutter widgets.
Dart types are non-nullable by default, and a nullable type must be marked with ?.
- String name cannot hold null, while String? name can and must be checked or safely accessed before use.
- ?? supplies a fallback and ?. performs conditional access; ! asserts non-null and can throw if that assertion is wrong.
- late postpones initialization, but reading a late variable before assignment causes a runtime error, so I use it only when lifecycle order guarantees a value.
Why interviewers ask this: The interviewer evaluates whether you handle absence explicitly instead of relying on unsafe assertions.
I choose List for ordered values, Set for unique values, and Map for key-value lookup.
- A List keeps order and permits duplicates, which suits a sequence of messages or products.
- A Set removes duplicates and provides efficient membership checks, such as selected category IDs.
- A Map retrieves a value by key, such as userById[id], and collection if and for can build any of these collections declaratively.
Why interviewers ask this: The interviewer checks whether you can match Dart's core collections to common application data.
Dart supports optional positional or named parameters, and functions can be passed and stored like other values.
- Named parameters use braces and required marks mandatory ones, which makes calls such as createUser(name: 'Ana') readable.
- Optional parameters need a nullable type or a default value, while positional optional parameters use brackets.
- A callback such as VoidCallback can be passed to a button, and a short single-expression function can use => syntax.
Why interviewers ask this: A good answer shows the function syntax used constantly in Flutter constructors and callbacks.
A Dart class groups state and behavior, and its constructors create valid instances.
- this.name in a constructor parameter initializes a field directly, while required named parameters make required input explicit.
- A named constructor such as User.guest() provides another clear creation path, and a factory constructor may return a cached instance or subtype.
- extends reuses one superclass implementation, and overridden members should be marked with @override so the analyzer can verify them.
Why interviewers ask this: The interviewer is checking practical object construction and basic inheritance rather than syntax memorization.
An interface defines a contract to implement, while a mixin supplies reusable behavior to classes.
- Every Dart class exposes an implicit interface, and implements requires the new class to provide all interface members.
- An interface class can be implemented but not extended outside its library, which makes the intended API boundary explicit.
- A mixin is applied with with and can share methods across unrelated classes without creating a deep inheritance chain.
Why interviewers ask this: A strong answer reflects Dart 3 class modifiers and does not confuse a behavior mixin with an interface contract.
Records return or group a few typed values without declaring a dedicated class, and patterns unpack or test their shape.
- A function can return (User, bool), keeping both field types in the static type system.
- A destructuring declaration such as final (user, cached) = result gives names to the record fields.
- List, map, object, and switch patterns can extract nested values, but I still use a named class when data needs identity, methods, or a stable public model.
Why interviewers ask this: The interviewer checks whether you know modern Dart syntax and can choose it without replacing meaningful domain models.
A sealed class defines a closed family of subtypes that a switch can handle exhaustively.
- Subtypes must be declared in the same library, so the compiler knows the complete set.
- Loading, Success(data), and Failure(error) are a practical sealed result hierarchy for a screen.
- A switch expression over that hierarchy reports a compile-time error when a case is missing, including after a new subtype is added.
Why interviewers ask this: A strong answer connects sealed types to exhaustive state handling rather than presenting them as syntax trivia.
A Future completes once with a value or error, while a Stream can emit multiple values over time.
- I await a Future for one REST response or file read and catch its failure with try and catch.
- I listen to a Stream for repeated events such as authentication changes or live database updates.
- Stream subscriptions should be cancelled when their owner is disposed, while await for can consume events until the stream closes.
Why interviewers ask this: The interviewer checks whether you can select and clean up Dart's basic asynchronous abstractions.
In Flutter, the build method describes the UI for the current state instead of issuing commands to mutate individual views.
- When state changes, Flutter calls build again and compares the new widget configuration with the existing tree.
- A loading flag can select a progress indicator or content directly in the widget tree.
- build should stay free of network calls and other side effects because the framework may invoke it many times.
Why interviewers ask this: The interviewer evaluates whether you understand Flutter's state-to-UI model and keep build repeatable.
I use StatelessWidget when the widget has no mutable local state and StatefulWidget when state must live across rebuilds.
- Both widget objects are immutable; a StatefulWidget creates a separate mutable State object.
- A title rendered only from constructor arguments fits StatelessWidget, while a local password-visibility toggle fits StatefulWidget.
- If state belongs to several screens or business logic, I move it above the widget or into a state-management layer instead of adding more local State.
Why interviewers ask this: A strong answer knows that StatefulWidget itself is immutable and keeps state at the appropriate scope.
A State object is initialized, may receive dependency or widget updates, rebuilds, and is eventually disposed.
- initState runs once for setup that does not depend on inherited widgets, such as creating an AnimationController.
- didChangeDependencies handles inherited dependencies, and didUpdateWidget reacts when the parent supplies a new widget configuration.
- dispose releases controllers, focus nodes, and subscriptions before calling super.dispose.
Why interviewers ask this: The interviewer checks whether you place setup, updates, and cleanup in the correct lifecycle callbacks.
BuildContext identifies a widget's location in the element tree and is used to find ancestors such as Theme or Navigator.
- Theme.of(context) searches upward from that exact location, so the required provider must be an ancestor.
- A context above a newly created Scaffold cannot find that Scaffold; Builder can create a context below it.
- After an await, I check context.mounted before navigation or showing UI because the widget may have been removed.
Why interviewers ask this: A good answer treats context as a tree location and recognizes both ancestor scope and asynchronous lifetime.
Widgets are immutable configurations, elements manage their mounted identity, and render objects perform layout and painting.
- build creates lightweight widget descriptions that can be replaced on every rebuild.
- An element links a widget to its tree position and preserves associated State when type and key still match.
- RenderObject instances receive constraints, choose sizes, paint pixels, and perform hit testing for render-backed widgets.
Why interviewers ask this: The interviewer checks whether you understand Flutter beyond saying that everything is a widget.
Keys help Flutter match widget configurations to existing elements when sibling order or identity changes.
- ValueKey(item.id) keeps the correct State attached when a reorderable list moves items.
- Keys matter among siblings of the same widget type; adding random UniqueKeys forces state loss instead of fixing identity.
- GlobalKey can access state or move an element across the tree, but it is heavier and should be reserved for cases such as FormState.
Why interviewers ask this: A strong answer explains identity preservation and avoids treating GlobalKey as the default solution.
A parent sends constraints down, each child chooses a permitted size, and the parent positions that child.
- Constraints specify minimum and maximum width and height rather than one exact size in every case.
- A child cannot choose a size outside those limits, so setting width to 500 does not override a parent's maximum of 300.
- Unbounded constraints commonly appear inside scrollables and can conflict with Expanded or a child that tries to take infinite space.
Why interviewers ask this: The interviewer checks whether you can reason about common layout behavior from constraints instead of guessing at sizes.
Row and Column use Flex layout, and Expanded or Flexible decides how children share remaining main-axis space.
- Row lays children horizontally and Column vertically, while mainAxisAlignment distributes free space on that axis.
- Expanded uses a tight fit and makes its child fill its flex share, which can prevent text from overflowing a Row.
- Flexible defaults to a loose fit, allowing its child to use less than its share, and flex values divide space proportionally.
Why interviewers ask this: A good answer connects Flex widgets to a concrete overflow and space-sharing model.
For a long or dynamic list I use ListView.builder so only visible items and nearby cache items are built.
- A ListView with an explicit children list eagerly creates every child and suits only a small fixed list.
- SingleChildScrollView builds its entire child, so wrapping a large Column in it wastes memory and build work.
- For mixed scrolling sections such as an app bar, grid, and list, CustomScrollView with slivers composes them into one scroll view.
Why interviewers ask this: The interviewer evaluates whether you understand lazy construction and avoid expensive scroll layouts.
MaterialApp provides ThemeData for Material widgets, while CupertinoApp provides CupertinoThemeData for iOS-style widgets.
- Theme.of(context) and CupertinoTheme.of(context) read inherited colors and typography instead of duplicating constants per screen.
- A ColorScheme lets Material components use consistent roles such as primary, surface, and error in light and dark themes.
- I choose one coherent design system for the product and use platform-adaptive controls only where users expect native behavior.
Why interviewers ask this: A strong answer knows both theme systems and avoids mixing platform styles without a product reason.
Locked questions
- 21
How would you validate and submit a form in Flutter?
formsfluttervalidation - 22
How do TextEditingController and FocusNode need to be managed?
- 23
When would you use GestureDetector instead of InkWell?
interaction - 24
How do you navigate to a screen and return a result in Flutter?
flutter - 25
How do you add images and custom fonts to a Flutter app?
flutter - 26
How would you make a Flutter screen responsive?
responsiveflutter - 27
What is the basic Flutter localization workflow?
flutter - 28
How do you make a basic Flutter screen accessible?
flutter - 29
When would you use an implicit animation in Flutter?
flutteranimation - 30
What must you do when using AnimationController?
animation - 31
When is setState appropriate, and what does it do?
state - 32
What does lifting state up mean in Flutter?
flutter - 33
When would you use ValueNotifier and ValueListenableBuilder?
- 34
What is the basic Riverpod flow in a Flutter screen?
flutterstate-management - 35
What is the basic idea behind BLoC in Flutter?
flutterstate-management - 36
How would you call a REST API from a Flutter app?
restflutter - 37
How do you convert a JSON response into a Dart model?
dart - 38
How should a Flutter app handle network errors and timeouts?
flutterresilience - 39
Which local storage option would you choose in a Flutter app?
flutter - 40
What is involved in adding Firebase to a Flutter app?
flutter - 41
What is pubspec.yaml used for in a Flutter project?
yamlpackagesflutter - 42
How do you evaluate a Flutter package before adding it?
decision-makingflutter - 43
What basic Git workflow do you use for a Flutter feature?
fluttergit - 44
What do dart analyze and dart format do?
dart - 45
What is the difference between hot reload and hot restart?
tooling - 46
How do Flutter build modes differ from app flavors?
flutter - 47
What are unit, widget, and integration tests in Flutter?
integrationintegration-testingflutter - 48
How do you add and request a mobile permission in Flutter?
flutter - 49
How can a Flutter app react to application lifecycle changes?
reactflutter - 50
What do you use Flutter DevTools for?
flutterflutter-devtools - 51
A Row shows yellow and black overflow stripes on a narrow phone; how would you fix it?
- 52
A ListView inside a Column throws an unbounded height error; what exact change would you make?
schema - 53
A screen creates 1,000 product cards in a Column and pauses while opening; how would you rebuild the list?
schema - 54
An HTTP request finishes after the user leaves a screen and Flutter reports setState() called after dispose(); how would you fix it?
flutterstatehttp - 55
A search screen creates a TextEditingController and its listener still fires after repeated navigation; what should be cleaned up?
navigation - 56
After reordering editable task rows, typed text appears on the wrong task; how would you correct the keys?
- 57
A FutureBuilder refetches a profile whenever its parent rebuilds and the spinner flashes repeatedly; how would you stop it?
async - 58
A save completes after the page was popped, then showing a SnackBar with context fails; what would you change?
- 59
A login form submits invalid fields without visible messages and leaves the keyboard covering the result; how would you fix the flow?
forms - 60
Image.asset works for one developer but shows Unable to load asset in CI with a case-sensitive file system; what would you inspect?
system-design - 61
A REST client tries to decode every response as JSON, crashes on 204, and leaves a spinner running on 401; how would you handle statuses?
rest - 62
The API sometimes returns null for avatarUrl and omits address, causing a type cast error; how would you make parsing safe?
fundamentals - 63
A product request can hang forever on a poor connection; how would you add timeout and recovery behavior?
resilience - 64
A feed briefly shows No items while its first request is still loading; how would you model the screen?
- 65
Fast scrolling requests page 3 twice and duplicate products appear; how would you fix basic pagination?
pagination - 66
A notes screen must show the last successful list when the phone opens offline; what basic cache would you add?
caching - 67
A review finds an access token stored in SharedPreferences; where should it go and what else would you check?
tokens - 68
Firebase Auth signs in successfully, but the app briefly shows the login screen on every restart; how would you fix startup routing?
- 69
FCM messages arrive in logs while the app is foregrounded, but users see no banner; what would you implement?
- 70
Refreshing a populated catalog fails with 500 and the screen becomes blank; what error UI would you show?
- 71
A Riverpod counter changes after a button tap but its label stays stale because the widget used ref.read; what would you change?
widgetsstate-management - 72
A ConsumerWidget throws No ProviderScope found when opened in a widget test; how would you fix the scope?
widgetsstate-management - 73
Double-tapping Save dispatches two BLoC events and creates two records; how would you prevent it?
state-management - 74
A checkout BLoC resets whenever a parent calls setState, so entered delivery data disappears; what would you inspect?
statestate-management - 75
Typing in one field appears to rebuild an entire Riverpod product screen; how would you diagnose and reduce it?
state-management - 76
A connectivity StreamSubscription keeps updating a removed screen; how would you clean it up?
streams - 77
A Timer.periodic continues refreshing after its dashboard is closed; what exact lifecycle fix is needed?
- 78
Decoding a 5 MB JSON response freezes scrolling for a noticeable moment; how would you move that work off the UI isolate?
concurrency - 79
A user types cat then car, but the slower cat request finishes last and replaces the car results; how would you fix the race?
- 80
Leaving an upload screen does not stop its request and a late progress callback touches disposed state; how would you add cancellation?
resiliencecallbacks - 81
A widget test taps Submit, but the expected success text never appears because the UI waits on a Future; how would you pump it correctly?
widgets - 82
A golden test matches locally but text differs in CI because another font is used; how would you stabilize it?
- 83
A profile widget test calls the real staging API and fails offline; how would you replace that dependency?
widgetsapidependencies - 84
How would you write one integration test for signing in and opening the profile screen?
integrationintegration-testing - 85
A production bug report only says request failed, while debug logs print full tokens; how would you improve logging safely?
tokensloggingbug-reporting - 86
Tapping Scan does nothing after the user denies camera permission; how would you handle the permission flow?
- 87
An Android debug build cannot call a local http API and reports cleartext traffic not permitted; what would you change?
http - 88
The iOS app closes when opening the photo picker and the console mentions a missing usage description; what is the fix?
- 89
Opening myapp://product/42 launches the app but always shows Home; how would you debug the deep link?
- 90
A polling timer keeps making requests while the app is backgrounded; how would you react to app lifecycle changes?
react - 91
A Git merge leaves conflict markers in pubspec.yaml and one Dart file; how would you resolve the conflict safely?
gityamlpackages - 92
flutter pub get fails because package_a requires http below 1.0 while package_b requires http 1.x; what would you do?
flutterhttp - 93
After adding a json_serializable field, the generated part lacks it and compilation fails; how would you refresh generation?
- 94
CI fails flutter analyze for an unawaited save call that works during manual testing; how would you fix it?
fluttertesting - 95
An Android release build is rejected because it is signed with the debug certificate; what would you verify?
- 96
The staging flavor accidentally sends requests to production; how would you separate and verify environments?
- 97
A screen reader announces an icon-only trash button only as Button; how would you make it accessible?
a11y - 98
A phone layout stretches one text column across a 12-inch tablet and becomes hard to read; how would you adapt it?
schema - 99
The app displays 1 items and English rules are reused in Russian; how would you localize the count correctly?
- 100
In code review, a catch block ignores a failed order request and finally always shows Order placed; what defect would you report and fix?
code-reviewdefects