Flutter Interview Questions and Answers (2026): 300+ MCQs and Short Answers

In short: this is a free bank of 320 Flutter interview questions and answers for 2026 — 160 multiple-choice questions and 160 short-answer questions across Dart, the widget tree, state management, async and isolates, navigation, networking, animations, testing, performance, architecture, and release. Every question is tagged Junior, Mid, or Senior, and a learning-mode switch hides the answers so you can quiz yourself, then reveal the answer and explanation one question at a time.

Skip the intro — start the 320 practice questions Follow me on Instagram@sagnikteaches

Whether you are preparing for your first Flutter role or a senior interview, the fastest way to get sharper is active recall: try to answer before you read the solution. Keep the toggle on for a quiz-style flow — pick an option, submit, then read the explanation — or switch it off to revise every answer at once. Use the level filter to focus on Junior, Mid, or Senior questions, and the topic links to drill a single area such as state management or async. The topic mix is cross-checked against Flutter's architectural overview, Dart's language docs, and the official Flutter docs for state management, testing, and performance profiling.

Connect on LinkedInSagnik Bhattacharya
The Complete Flutter Guide course thumbnail

The Complete Flutter Guide: Build Android, iOS and Web apps

Want to go from interview-ready to job-ready? Build industry-standard apps with Riverpod, Firebase, animations, REST APIs, and more.

Get 85% off on Udemy

How to use these Flutter interview questions

The bank is grouped into 14 topics, mirroring how real Flutter interviews move from language fundamentals to architecture and release. Each topic opens with a question-shaped heading, then mixes multiple-choice and short-answer questions so you switch between recognising the right answer and recalling it from memory. Junior questions check whether you know the building blocks, Mid questions probe how you use them in real apps, and Senior questions ask about trade-offs, performance, and architecture.

  • Quiz mode (default): leave the switch on, choose an answer, submit, then read why it is right.
  • Revision mode: turn the switch off to show every answer for fast review before an interview.
  • Targeted practice: filter by level, or jump to a topic such as state management or async.
Subscribe on YouTube@codingliquids

320 Flutter interview questions and answers

Use the controls below to switch between quiz and revision mode, filter by experience level, and track how many multiple-choice questions you have answered correctly.

Answered 0 of 160 MCQs

What Dart language questions come up in Flutter interviews?

Types, null safety, futures, collections, and the language features Flutter is built on. 13 MCQs · 13 short answers

1MCQDart language & null safetyJunior

What does the const keyword guarantee for a Dart variable?

Choose one answer for question 1

Correct answer: B. A compile-time constant that is fully immutable

Why: const is a canonicalised compile-time constant; final is assign-once at runtime.

1Short answerDart language & null safetyJunior

What is the difference between var, final, and const?

Answer: var declares a mutable variable whose type is inferred. final is assigned once at runtime and cannot be reassigned afterwards. const is a compile-time constant that is deeply immutable and canonicalised, so identical const values share one instance.

2MCQDart language & null safetyJunior

Which operator safely accesses a member only when the value is non-null?

Choose one answer for question 2

Correct answer: C. ?.

Why: ?. is null-aware access; ! asserts non-null, ?? supplies a default, .. is cascade.

2Short answerDart language & null safetyJunior

What does null safety mean in Dart?

Answer: Types are non-nullable by default, so a String can never hold null, while String? opts into nullability. The compiler forces you to handle the nullable case before using a value, which removes a whole class of null-reference crashes.

3Short answerDart language & null safetyMid

Explain how async and await work in Dart.

Answer: Marking a function async makes it return a Future and lets you use await inside it. await suspends the function until the awaited Future completes, then resumes with its value, without blocking the isolate. This lets you write asynchronous code in a sequential, readable style.

3MCQDart language & null safetyJunior

What is the difference between final and const?

Choose one answer for question 3

Correct answer: B. final is assigned once at runtime; const must be known at compile time

Why: Both prevent reassignment, but only const is a compile-time constant.

4MCQDart language & null safetyJunior

What does the late keyword do?

Choose one answer for question 4

Correct answer: B. Declares a non-nullable variable initialised after its declaration

Why: late allows a non-nullable field assigned before first use, and can defer initialisation lazily.

4Short answerDart language & null safetyMid

What are mixins and when would you use one?

Answer: A mixin lets you reuse a class's members in many class hierarchies without classic inheritance, applied with the with keyword. You use mixins to share behaviour across unrelated classes, for example TickerProviderStateMixin to provide a vsync for animations.

Learn Flutter properly: The Complete Flutter Guide — Riverpod, Firebase, REST APIs, animations and more.Get 85% off on Udemy
5Short answerDart language & null safetyJunior

What is the difference between named and positional parameters?

Answer: Positional parameters are matched by order, while named parameters are passed by name inside braces and may be optional or required. Named parameters make call sites readable and let callers skip optional arguments.

5MCQDart language & null safetyMid

In a ?? b, what does the null-coalescing operator return?

Choose one answer for question 5

Correct answer: A. a if it is non-null, otherwise b

Why: ?? returns the left operand unless it is null, in which case it returns the right.

6Short answerDart language & null safetyMid

What is the cascade operator and why is it useful?

Answer: The cascade .. performs a sequence of operations on the same object without repeating its reference, and the whole expression evaluates to that object. It is handy for configuring an object or builder fluently in one statement.

6MCQDart language & null safetyMid

How do extends, implements, and with differ?

Choose one answer for question 6

Correct answer: B. extends inherits, implements reimplements an interface, with applies a mixin

Why: Each expresses a different reuse relationship: inheritance, interface, and mixin.

7Short answerDart language & null safetyMid

What is the difference between dynamic and Object?

Answer: Object? is the statically checked top type, so you must check or cast before calling type-specific members. dynamic switches off static type checking, allowing any member access that is only verified at runtime. Prefer Object for safety and use dynamic deliberately.

8Short answerDart language & null safetySenior

How do sealed classes and pattern matching help model state?

Answer: A sealed class restricts a type to a known set of subtypes, so the compiler can verify a switch handles every case exhaustively. Combined with pattern matching, they model finite states such as Loading, Success, and Error cleanly, catching missing cases at compile time.

Learn Flutter properly: The Complete Flutter Guide — Riverpod, Firebase, REST APIs, animations and more.Get 85% off on Udemy
7MCQDart language & null safetyMid

What is a factory constructor used for?

Choose one answer for question 7

Correct answer: B. To return an existing, cached, or subtype instance rather than always a new one

Why: A factory controls instance creation, e.g. caching or returning a subtype.

9Short answerDart language & null safetyJunior

What does the spread operator do in a collection literal?

Answer: The spread ... inserts all elements of one collection into another collection literal. The null-aware form ...? simply skips the spread when the source collection is null.

8MCQDart language & null safetyMid

What does an async function always return?

Choose one answer for question 8

Correct answer: C. A Future

Why: An async function returns a Future that completes with the value or error.

10Short answerDart language & null safetyMid

How do getters and setters work in Dart?

Answer: A getter, declared with get, is a computed property you access like a field. A setter, declared with set, runs code when you assign to the property. Together they let you expose computed or validated values using field-like syntax.

9MCQDart language & null safetyJunior

Which collection type stores unique, unordered values?

Choose one answer for question 9

Correct answer: C. Set

Why: A Set holds unique elements with no guaranteed order.

11Short answerDart language & null safetySenior

For a final list versus a const list, what can change?

Answer: A final list fixes the reference but still lets you mutate its contents, such as adding elements. A const list is deeply immutable and created at compile time, so neither the reference nor its elements can change.

10MCQDart language & null safetySenior

What is the difference between == and identical()?

Choose one answer for question 10

Correct answer: B. == tests equality (overridable); identical() tests whether two references are the same object

Why: identical() is reference identity; == is value equality you can override.

Learn Flutter properly: The Complete Flutter Guide — Riverpod, Firebase, REST APIs, animations and more.Get 85% off on Udemy
12Short answerDart language & null safetyMid

What does the ??= operator do?

Answer: ??= assigns the right-hand value only when the variable is currently null, and leaves it unchanged otherwise. It is a concise way to lazily initialise a nullable variable on first use.

13Short answerDart language & null safetyJunior

What is an enum, and how is an enhanced enum different?

Answer: An enum defines a fixed set of named constant values. Enhanced enums in modern Dart can also declare fields, constructors, and methods, so each value can carry data and behaviour rather than just being a label.

11MCQDart language & null safetySenior

What does an extension method let you do?

Choose one answer for question 11

Correct answer: B. Add behaviour to an existing type without subclassing it

Why: Extensions add methods and getters to existing types at the call site.

12MCQDart language & null safetyMid

What does sound null safety guarantee?

Choose one answer for question 12

Correct answer: B. A non-nullable type can never hold null at runtime

Why: With sound null safety the compiler proves non-nullable values are never null.

13MCQDart language & null safetySenior

After await, what is the value type of Future<List<int>>?

Choose one answer for question 13

Correct answer: B. List<int>

Why: await unwraps the Future to its completed value, here a List<int>.

What are the most common Flutter basics interview questions?

Widgets, the build method, BuildContext, hot reload, and how a Flutter app starts. 13 MCQs · 13 short answers

14Short answerFlutter basics & the widget treeJunior

What is a widget in Flutter?

Answer: A widget is an immutable description of part of the user interface. Flutter composes a tree of widgets and rebuilds it as state changes. Almost everything, including layout, styling, and gesture handling, is expressed as a widget.

15Short answerFlutter basics & the widget treeJunior

What is the relationship between main and runApp?

Answer: main is the Dart entry point that runs first when the app starts. Inside it you call runApp with a root widget, which inflates that widget as the root of the tree and attaches it to the screen.

14MCQFlutter basics & the widget treeJunior

In Flutter, almost everything you see in the UI is a...

Choose one answer for question 14

Correct answer: B. Widget

Why: Flutter UIs are composed from widgets, including layout and styling.

15MCQFlutter basics & the widget treeJunior

What is the entry point of a Flutter app?

Choose one answer for question 15

Correct answer: A. runApp() called from main()

Why: main() calls runApp() with the root widget to start the app.

16Short answerFlutter basics & the widget treeMid

What is the difference between the widget tree and the element tree?

Answer: The widget tree is the immutable configuration you write in build methods. The element tree is the mutable runtime structure that holds each widget's location, lifecycle, and state and links it to a render object. Elements persist across rebuilds while widgets are recreated each time.

17Short answerFlutter basics & the widget treeJunior

What does a Scaffold provide?

Answer: Scaffold implements the basic Material visual layout. It offers slots for an app bar, body, floating action button, drawer, bottom navigation, and snackbars, so you don't have to build that chrome by hand.

16MCQFlutter basics & the widget treeJunior

What does a widget's build method return?

Choose one answer for question 16

Correct answer: B. A widget (tree)

Why: build describes part of the UI by returning a widget subtree.

Learn Flutter properly: The Complete Flutter Guide — Riverpod, Firebase, REST APIs, animations and more.Get 85% off on Udemy
17MCQFlutter basics & the widget treeJunior

What is BuildContext?

Choose one answer for question 17

Correct answer: B. A handle to a widget's location in the tree

Why: Context locates a widget in the tree and is used to look up ancestors and inherited data.

18Short answerFlutter basics & the widget treeMid

How does Flutter achieve a consistent UI across platforms?

Answer: Flutter draws its own widgets with its rendering engine, Impeller, rather than wrapping native platform controls. Because it controls every pixel, the UI looks and behaves consistently across Android, iOS, web, and desktop from a single codebase.

18MCQFlutter basics & the widget treeJunior

Which widget gives you Material structure such as an app bar, body, and floating action button?

Choose one answer for question 18

Correct answer: B. Scaffold

Why: Scaffold provides the standard Material visual layout.

19Short answerFlutter basics & the widget treeJunior

What is the difference between EdgeInsets.all and EdgeInsets.symmetric?

Answer: EdgeInsets.all applies the same inset to all four sides. EdgeInsets.symmetric lets you set horizontal and vertical insets separately. Both describe spacing for widgets such as Padding or Container.

20Short answerFlutter basics & the widget treeMid

What is Theme and how do you read it?

Answer: Theme carries colours, typography, and component styling down the tree through an InheritedWidget. You read it with Theme.of(context), which lets widgets adapt to the app's design and to light or dark mode.

19MCQFlutter basics & the widget treeJunior

What does hot reload preserve that hot restart does not?

Choose one answer for question 19

Correct answer: B. The current app state

Why: Hot reload keeps state while updating the tree; hot restart resets to initial state.

21Short answerFlutter basics & the widget treeJunior

At a high level, what does setState do?

Answer: setState tells Flutter that a StatefulWidget's state has changed and it should rebuild. You mutate the relevant state inside its callback, and Flutter schedules a rebuild of that widget on the next frame.

20MCQFlutter basics & the widget treeMid

How do MaterialApp and CupertinoApp mainly differ?

Choose one answer for question 20

Correct answer: B. In the design language and default widgets they provide

Why: They set up Material vs iOS-style theming, navigation, and widgets.

Learn Flutter properly: The Complete Flutter Guide — Riverpod, Firebase, REST APIs, animations and more.Get 85% off on Udemy
22Short answerFlutter basics & the widget treeMid

Why does using the correct BuildContext matter?

Answer: BuildContext identifies a widget's position in the tree and is used to find ancestors and inherited widgets such as Theme or Navigator. A context taken from the wrong location may not find the expected ancestor, which is why helpers like Builder give you a context lower in the tree.

23Short answerFlutter basics & the widget treeSenior

How can the widget tree be immutable while the UI still changes?

Answer: Widgets are cheap, throwaway configuration objects recreated on each build. The persistent, mutable parts live in elements and State objects. Flutter diffs the new widget tree against the existing elements and updates only what actually changed, which keeps rebuilding efficient.

21MCQFlutter basics & the widget treeMid

What is the role of pubspec.yaml?

Choose one answer for question 21

Correct answer: B. It declares dependencies, assets, fonts, and project metadata

Why: pubspec.yaml is the project manifest read by the Dart and Flutter tooling.

22MCQFlutter basics & the widget treeMid

What do the widget, element, and render trees represent?

Choose one answer for question 22

Correct answer: B. Configuration, instantiation and lifecycle, and layout and paint respectively

Why: Widgets configure, elements hold lifecycle and identity, render objects do layout and painting.

24Short answerFlutter basics & the widget treeJunior

What is the difference between Image.asset and Image.network?

Answer: Image.asset loads an image bundled with the app and declared in pubspec.yaml. Image.network downloads an image from a URL at runtime and can display loading and error states while it fetches.

23MCQFlutter basics & the widget treeMid

What does MediaQuery.of(context) provide?

Choose one answer for question 23

Correct answer: B. Screen size, padding, text scale, and device metrics

Why: MediaQuery exposes device and window metrics for responsive layout.

24MCQFlutter basics & the widget treeJunior

Which widget centres its single child?

Choose one answer for question 24

Correct answer: B. Center

Why: Center centres its child within itself.

Learn Flutter properly: The Complete Flutter Guide — Riverpod, Firebase, REST APIs, animations and more.Get 85% off on Udemy
25Short answerFlutter basics & the widget treeMid

How do you add assets and custom fonts to a Flutter app?

Answer: You place the files in the project and declare them under the assets and fonts sections of pubspec.yaml. Flutter then bundles them into the app, and you reference them by path or by the declared font family.

26Short answerFlutter basics & the widget treeJunior

What does hot reload do, and what are its limits?

Answer: Hot reload injects changed source into the running app and rebuilds the UI while keeping the current state, which makes UI iteration fast. It cannot apply changes to code that runs once, such as main, global variables, or static initialisers, where a hot restart is needed.

25MCQFlutter basics & the widget treeMid

What is the difference between Expanded and Flexible?

Choose one answer for question 25

Correct answer: B. Expanded forces the child to fill available space; Flexible lets it take up to that space

Why: Expanded is Flexible with fit: FlexFit.tight.

26MCQFlutter basics & the widget treeSenior

Why does Flutter use a declarative UI model?

Choose one answer for question 26

Correct answer: B. Because the UI is rebuilt as a function of state, so you describe what it should look like

Why: Declarative UI maps state to widgets, removing imperative view mutation.

Which Flutter widget and key questions get asked?

Stateless vs stateful, common widgets, builders, and when keys actually matter. 12 MCQs · 12 short answers

27Short answerWidgets & keysJunior

When do you use a StatefulWidget instead of a StatelessWidget?

Answer: Use a StatefulWidget when the widget must change during its lifetime in response to input, timers, or async results, so you can hold state and call setState. Use a StatelessWidget when the output depends only on its constructor inputs and never changes itself.

27MCQWidgets & keysJunior

When should you choose a StatelessWidget over a StatefulWidget?

Choose one answer for question 27

Correct answer: B. When its appearance depends only on its inputs and never changes itself

Why: Stateless widgets have no mutable state; use them for input-driven, unchanging UI.

28MCQWidgets & keysJunior

Where does a StatefulWidget keep its mutable state?

Choose one answer for question 28

Correct answer: B. In a separate State object

Why: StatefulWidget is immutable; its State object holds data that survives rebuilds.

28Short answerWidgets & keysMid

What is the difference between ListView and ListView.builder?

Answer: A plain ListView builds all of its children immediately, which suits short, fixed lists. ListView.builder builds items lazily as they scroll into view, which is essential for long or infinite lists to keep memory and build time bounded.

29Short answerWidgets & keysMid

What problem do keys solve in dynamic lists?

Answer: Without keys, Flutter matches widgets to elements by position and type, so reordering or removing stateful items can attach the wrong state to a widget. Keys give items a stable identity so their state follows them when the list changes.

29MCQWidgets & keysMid

Why prefer ListView.builder over a ListView with a fixed children list?

Choose one answer for question 29

Correct answer: B. It lazily builds only the items near the viewport, saving memory

Why: builder constructs items on demand, scaling to long or infinite lists.

30MCQWidgets & keysMid

What is the main difference between Container and SizedBox?

Choose one answer for question 30

Correct answer: B. SizedBox is a lightweight box for sizing and spacing; Container bundles padding, decoration, and constraints

Why: Use SizedBox for simple sizing; Container when you need decoration or several effects.

Learn Flutter properly: The Complete Flutter Guide — Riverpod, Firebase, REST APIs, animations and more.Get 85% off on Udemy
30Short answerWidgets & keysJunior

What is the difference between a Column and a ListView?

Answer: A Column lays out a fixed set of children and does not scroll, so it overflows if they exceed the available space. A ListView is scrollable and can build many children lazily, which suits long or dynamic content.

31Short answerWidgets & keysMid

What does the Builder widget solve in practice?

Answer: Builder gives you a fresh BuildContext located below the current widget. That matters when you need a context that can find an ancestor, such as a Scaffold or a Provider, created in the same build method that the outer context cannot see.

31MCQWidgets & keysMid

When do you actually need to give a widget a Key?

Choose one answer for question 31

Correct answer: B. When same-type widgets are reordered, added, or removed in a list and must keep state

Why: Keys let Flutter match elements to widgets correctly when positions change.

32MCQWidgets & keysSenior

How does a GlobalKey differ from a ValueKey?

Choose one answer for question 32

Correct answer: B. GlobalKey uniquely identifies a widget across the whole tree and exposes its state or context; ValueKey only distinguishes siblings

Why: GlobalKeys are powerful but heavier, so use them sparingly.

32Short answerWidgets & keysSenior

Explain GlobalKey and a downside of overusing it.

Answer: A GlobalKey uniquely identifies a widget across the whole tree and exposes its state and context, which is useful for things like form state. Overusing it couples widgets together, makes the data flow harder to follow, and is comparatively expensive, so prefer passing data through constructors.

33Short answerWidgets & keysJunior

What is SizedBox used for?

Answer: SizedBox creates a box with a specific width and height, and with no child it adds fixed spacing between widgets. It is a lightweight choice when you only need sizing or a gap, without the extra features of Container.

33MCQWidgets & keysJunior

What does SafeArea do?

Choose one answer for question 33

Correct answer: B. Insets its child to avoid notches, status bars, and other system intrusions

Why: SafeArea pads content away from device UI such as notches and the status bar.

Learn Flutter properly: The Complete Flutter Guide — Riverpod, Firebase, REST APIs, animations and more.Get 85% off on Udemy
34Short answerWidgets & keysMid

How do Wrap and Row differ?

Answer: A Row places its children on a single horizontal line and overflows if they don't fit. A Wrap arranges children in runs and moves to the next line when space runs out, which suits chips, tags, and flowing content.

34MCQWidgets & keysMid

Why might you use a Builder widget?

Choose one answer for question 34

Correct answer: B. To obtain a BuildContext below the current widget, for example to reach an ancestor provided in the same build method

Why: Builder gives a fresh context under the current widget where the inherited ancestor exists.

35MCQWidgets & keysJunior

Which widget displays styled text?

Choose one answer for question 35

Correct answer: B. Text

Why: Text renders a string with an optional TextStyle.

35Short answerWidgets & keysSenior

What are slivers and when do you reach for them?

Answer: Slivers are scrollable regions with custom scroll behaviour placed inside a CustomScrollView. You use slivers like SliverList, SliverGrid, and SliverAppBar when you need effects such as a collapsing header or several scrolling sections that a plain ListView cannot express.

36Short answerWidgets & keysJunior

How does Padding differ from a Container with padding?

Answer: Padding only insets its child by the given amount and nothing more. A Container can add padding too but also supports decoration, constraints, margins, and alignment. Use Padding when spacing is all you need.

36MCQWidgets & keysMid

What is the difference between GestureDetector and InkWell?

Choose one answer for question 36

Correct answer: B. InkWell adds a Material ripple and needs a Material ancestor; GestureDetector only detects gestures

Why: Use InkWell for Material feedback and GestureDetector for raw gestures.

37Short answerWidgets & keysSenior

Why are most Flutter widgets immutable, and how does interactivity still work?

Answer: Immutable widgets are cheap to create and safe to compare, which makes rebuilding the tree efficient. Interactivity lives in the mutable State objects and elements behind StatefulWidgets, so the configuration stays immutable while the runtime state changes through setState.

Learn Flutter properly: The Complete Flutter Guide — Riverpod, Firebase, REST APIs, animations and more.Get 85% off on Udemy
37MCQWidgets & keysMid

What does AnimatedBuilder help you avoid?

Choose one answer for question 37

Correct answer: B. Rebuilding an entire subtree on each animation tick by isolating the animating part

Why: It rebuilds only the builder output per tick, keeping the rest static.

38Short answerWidgets & keysMid

What is the difference between Visibility, Offstage, and Opacity?

Answer: Visibility shows or hides a child and can optionally keep its layout space. Offstage lays the child out but does not paint it or hit-test it. Opacity paints the child at a given transparency. They differ in whether the child is laid out, painted, and interactive.

38MCQWidgets & keysSenior

Why does Flutter favour composition over inheritance for building UI?

Choose one answer for question 38

Correct answer: B. Small widgets combined together are more flexible and reusable than deep class hierarchies

Why: Composition keeps widgets small and recombinable, which Flutter is designed around.

How do Flutter layout and constraint questions work?

Constraints go down, sizes go up; Row, Column, Flex, Stack, and overflow fixes. 12 MCQs · 12 short answers

39Short answerLayout & constraintsJunior

Explain how constraints work in Flutter layout.

Answer: A parent passes constraints, the minimum and maximum width and height, down to its child. The child chooses its own size within those constraints and reports it back up, and the parent then positions it. The slogan is: constraints go down, sizes go up, and the parent sets position.

39MCQLayout & constraintsJunior

A Row arranges its children...

Choose one answer for question 39

Correct answer: B. Horizontally along the main axis

Why: Row lays children out horizontally; Column is vertical.

40Short answerLayout & constraintsMid

How would you fix a RenderFlex overflow in a Row?

Answer: Find the child that is too wide and constrain it: wrap it in Expanded or Flexible so it shares the available width, shorten its content, or make the Row scrollable. The overflow happens because the children's combined width exceeds the Row's width.

40MCQLayout & constraintsJunior

What is the main axis of a Column?

Choose one answer for question 40

Correct answer: B. Vertical

Why: A Column main axis runs vertically; its cross axis is horizontal.

41MCQLayout & constraintsMid

Which phrase best summarises Flutter's layout algorithm?

Choose one answer for question 41

Correct answer: B. Constraints go down, sizes go up, and the parent sets position

Why: Parents pass constraints down, children pick sizes within them, and parents position children.

41Short answerLayout & constraintsMid

What is the difference between Expanded and Flexible?

Answer: Both let a child flex inside a Row or Column, but Expanded forces the child to fill all the space it is assigned (a tight fit), while Flexible lets the child take up to that space (a loose fit). Expanded is simply Flexible with FlexFit.tight.

42MCQLayout & constraintsMid

What commonly causes a RenderFlex overflow in a Row?

Choose one answer for question 42

Correct answer: B. Children whose combined width exceeds the available horizontal space

Why: Wrap a child in Expanded or Flexible, or make the row scrollable, to fix it.

42Short answerLayout & constraintsJunior

What do MainAxisAlignment and CrossAxisAlignment control?

Answer: MainAxisAlignment positions children along the primary direction of a Row or Column, horizontal for a Row and vertical for a Column. CrossAxisAlignment positions them along the perpendicular direction. Together they control alignment on both axes.

Learn Flutter properly: The Complete Flutter Guide — Riverpod, Firebase, REST APIs, animations and more.Get 85% off on Udemy
43MCQLayout & constraintsMid

What does wrapping a child in Expanded inside a Row do?

Choose one answer for question 43

Correct answer: B. Makes the child take the remaining space along the main axis

Why: Expanded gives the child a tight flex fit to fill leftover main-axis space.

43Short answerLayout & constraintsMid

How do you overlap widgets on top of each other?

Answer: Use a Stack, which paints its children in order, one over another. Wrap a child in Positioned to place it relative to the stack's edges, or leave it unpositioned to align it within the stack using the stack's alignment.

44MCQLayout & constraintsJunior

What does MainAxisAlignment control in a Row or Column?

Choose one answer for question 44

Correct answer: B. How children are positioned and spaced along the main axis

Why: It distributes children along the main axis, for example spaceBetween or center.

45MCQLayout & constraintsSenior

Why does putting a ListView directly inside a Column throw an unbounded-height error?

Choose one answer for question 45

Correct answer: B. The Column passes unbounded vertical constraints, so the ListView cannot decide its height

Why: Give it bounded height, e.g. wrap in Expanded, so it receives finite constraints.

44Short answerLayout & constraintsSenior

Why does a ListView inside a Column throw, and how do you fix it?

Answer: A Column gives its children unbounded height, but a ListView wants to expand to fill the available vertical space, so it cannot resolve a height. Fix it by wrapping the ListView in Expanded or Flexible, giving it a fixed height with SizedBox, or using shrinkWrap for a short list.

45Short answerLayout & constraintsMid

What is LayoutBuilder, and when is it better than MediaQuery?

Answer: LayoutBuilder rebuilds with the constraints its parent passes, so you can adapt to the space available to that particular widget. MediaQuery reports the size of the whole screen. Prefer LayoutBuilder when a widget should react to its own box rather than the entire window.

Learn Flutter properly: The Complete Flutter Guide — Riverpod, Firebase, REST APIs, animations and more.Get 85% off on Udemy
46MCQLayout & constraintsMid

How do you position a widget at a specific offset within a Stack?

Choose one answer for question 46

Correct answer: B. Wrap it in Positioned

Why: Positioned sets a child location relative to the Stack edges.

46Short answerLayout & constraintsJunior

What is the difference between padding and margin?

Answer: Padding is the space inside a widget's boundary, between its edge and its child. Margin is the space outside the boundary that separates the widget from its neighbours. A Container lets you set both.

47MCQLayout & constraintsMid

What does LayoutBuilder give you?

Choose one answer for question 47

Correct answer: B. The parent constraints, so you can build differently for the available size

Why: LayoutBuilder exposes incoming constraints, useful for adaptive layouts.

47Short answerLayout & constraintsMid

How do you make a layout adapt to phone, tablet, and desktop?

Answer: Choose breakpoints based on the available width using LayoutBuilder or MediaQuery, then switch between layouts, such as a single column on phones and a master-detail or grid on larger screens. Widgets like Wrap, Flexible, and GridView help the content reflow gracefully.

48MCQLayout & constraintsJunior

What is the difference between padding and margin on a Container?

Choose one answer for question 48

Correct answer: B. Padding is space inside the border; margin is space outside it

Why: Padding insets the child within the box; margin offsets the box from neighbours.

49MCQLayout & constraintsSenior

Why can IntrinsicHeight be expensive?

Choose one answer for question 49

Correct answer: B. It performs an extra layout pass to measure children before sizing them

Why: Intrinsic sizing adds a speculative measurement pass, costly in large or nested trees.

48Short answerLayout & constraintsSenior

What does shrinkWrap do on a ListView, and what is the trade-off?

Answer: shrinkWrap makes a ListView size itself to its content instead of expanding to fill the viewport, which lets it sit inside a Column or another scrollable. The trade-off is that it builds all children to measure them, losing the lazy performance benefit, so it suits only short lists.

49Short answerLayout & constraintsMid

What does the Spacer widget do?

Answer: Spacer inserts flexible empty space along the main axis of a Row or Column, pushing the surrounding widgets apart. It behaves like an Expanded with an empty child and honours a flex factor, so it is handy for distributing items evenly.

Learn Flutter properly: The Complete Flutter Guide — Riverpod, Firebase, REST APIs, animations and more.Get 85% off on Udemy
50MCQLayout & constraintsMid

For responsive layouts, when is LayoutBuilder preferable to MediaQuery?

Choose one answer for question 50

Correct answer: B. When you need the space available to that widget rather than the whole screen size

Why: MediaQuery is screen-level; LayoutBuilder reacts to local box constraints.

50Short answerLayout & constraintsJunior

What is the difference between Align and Center?

Answer: Center places its child in the middle of the available space. Align is more general and can place the child at any alignment, such as topLeft or bottomRight, using an Alignment value. Center is just Align with Alignment.center.

What do interviews ask about Flutter state management?

setState, InheritedWidget, Provider, Riverpod, and BLoC — trade-offs and when to use each. 14 MCQs · 14 short answers

51Short answerState managementJunior

What is the difference between ephemeral state and app state?

Answer: Ephemeral, or local, state belongs to a single widget, such as the current page of a PageView or whether a checkbox is ticked, and setState handles it well. App, or shared, state is used across many widgets or screens, such as the logged-in user or a cart, and is better managed with Provider, Riverpod, or BLoC.

51MCQState managementJunior

What must you do inside the setState callback?

Choose one answer for question 51

Correct answer: B. Mutate the state that affects the build output

Why: Mutating state in setState tells Flutter to rebuild with the new values.

52Short answerState managementMid

How does Provider expose and update state?

Answer: Provider places a value, often a ChangeNotifier, above the widgets that need it. Descendants read it with context.watch or a Consumer to rebuild on change, or context.read for one-off access. When the notifier calls notifyListeners, the listening widgets rebuild.

52MCQState managementJunior

What does lifting state up mean?

Choose one answer for question 52

Correct answer: B. Moving shared state to the nearest common ancestor so several widgets can use it

Why: Shared state lives in a common parent and flows down to children.

53MCQState managementMid

What does InheritedWidget provide?

Choose one answer for question 53

Correct answer: B. Efficient propagation of data down the tree, rebuilding only dependents

Why: Descendants that depend on it rebuild when its data changes; it underpins Provider.

53Short answerState managementMid

What is a ChangeNotifier and how does it trigger rebuilds?

Answer: A ChangeNotifier holds mutable state and exposes notifyListeners. When you change state and call notifyListeners, every widget listening through Provider rebuilds. It is a simple observable model that works well for small and medium apps.

Learn Flutter properly: The Complete Flutter Guide — Riverpod, Firebase, REST APIs, animations and more.Get 85% off on Udemy
54Short answerState managementSenior

Why might you choose Riverpod over classic Provider?

Answer: Riverpod removes the dependency on BuildContext, so providers are global, compile-safe, and easy to test in isolation. It avoids pitfalls like ProviderNotFound, supports auto-disposal and families, and composes providers cleanly, which suits apps where testability and scalability matter.

54MCQState managementMid

What is Provider built on top of?

Choose one answer for question 54

Correct answer: B. InheritedWidget

Why: Provider wraps InheritedWidget to expose values and listen for changes.

55Short answerState managementSenior

Explain the BLoC pattern and its main benefit.

Answer: BLoC separates business logic from the UI by taking a stream of events and emitting a stream of immutable states. Widgets dispatch events and rebuild from the emitted states. The benefit is a predictable, testable, and traceable flow that scales well for complex features, at the cost of extra boilerplate.

56Short answerState managementMid

What is the difference between ref.watch, ref.read, and ref.listen in Riverpod?

Answer: ref.watch subscribes a build method to a provider and rebuilds when it changes. ref.read reads the current value once without subscribing, which suits callbacks. ref.listen runs a side effect, such as showing a snackbar, when a provider changes, without causing a rebuild.

55MCQState managementMid

What does a ChangeNotifier do?

Choose one answer for question 55

Correct answer: B. Holds state and calls notifyListeners() to trigger rebuilds of its listeners

Why: notifyListeners tells listening widgets, via Provider, to rebuild.

57Short answerState managementJunior

When is setState the right tool?

Answer: setState is right for simple, local UI state that only one widget cares about, such as toggling a password's visibility or tracking a single field. It is built in, needs no packages, and keeps simple widgets simple.

56MCQState managementSenior

What is the main advantage of Riverpod over classic Provider?

Choose one answer for question 56

Correct answer: B. It does not depend on BuildContext and is compile-safe and easy to test

Why: Riverpod providers are global, type-safe, and testable without the widget tree.

Learn Flutter properly: The Complete Flutter Guide — Riverpod, Firebase, REST APIs, animations and more.Get 85% off on Udemy
57MCQState managementSenior

In the BLoC pattern, data flows as...

Choose one answer for question 57

Correct answer: B. Events in, states out, usually over streams

Why: BLoC maps incoming events to a stream of immutable states the UI listens to.

58Short answerState managementMid

How do you avoid rebuilding too much when shared state changes?

Answer: Subscribe each widget only to the data it needs, using Consumer or Selector in Provider, or select in Riverpod, so it rebuilds only when its slice changes. Also split large widgets so unaffected parts can stay const and untouched.

58MCQState managementMid

What is the difference between ref.watch and ref.read in Riverpod?

Choose one answer for question 58

Correct answer: B. watch subscribes and rebuilds on change; read gets the value once without listening

Why: Use watch in build and read for one-off reads such as inside callbacks.

59Short answerState managementSenior

Why is immutable state important in state management?

Answer: Immutable state makes changes explicit: you create a new state object rather than mutating the old one, which makes equality checks cheap and rebuilds predictable. It avoids subtle bugs from shared mutable references and pairs well with patterns like BLoC and features like undo and redo.

59MCQState managementMid

Why use Selector in Provider or select in Riverpod?

Choose one answer for question 59

Correct answer: B. To rebuild only when a specific slice of state changes, reducing rebuilds

Why: Selecting a sub-value avoids rebuilding when unrelated parts of the model change.

60MCQState managementJunior

When is setState a perfectly good choice?

Choose one answer for question 60

Correct answer: B. For local, ephemeral UI state confined to one widget

Why: Local UI state such as a toggle or form field is fine with setState.

60Short answerState managementMid

What is the difference between context.watch and context.read in Provider?

Answer: context.watch subscribes the calling widget to the provider so it rebuilds on changes, and you use it in build. context.read fetches the value once without subscribing and is meant for event handlers such as onPressed, where you don't want a rebuild.

Learn Flutter properly: The Complete Flutter Guide — Riverpod, Firebase, REST APIs, animations and more.Get 85% off on Udemy
61Short answerState managementJunior

What does lifting state up achieve?

Answer: Moving shared state to the nearest common ancestor of the widgets that use it gives them one source of truth to read and update. It avoids duplicated copies of the same data drifting out of sync.

61MCQState managementSenior

Why is immutability preferred for state objects?

Choose one answer for question 61

Correct answer: B. It makes state changes predictable, comparable, and easier to debug and test

Why: Immutable state avoids hidden mutation bugs and enables cheap equality checks.

62Short answerState managementSenior

How do you decide which state management approach to use?

Answer: Match the tool to the complexity: setState for local state, Provider or Riverpod for most shared app state, and BLoC or Riverpod notifiers when you need strict event-to-state flows and traceability. Favour the simplest option that keeps the app testable and maintainable.

63Short answerState managementMid

What are FutureProvider and StreamProvider in Riverpod for?

Answer: They expose asynchronous data as a provider that emits an AsyncValue with loading, data, and error states. Widgets can render each state cleanly without manually wiring a FutureBuilder, and the result is cached and shareable across the app.

62MCQState managementMid

What is the risk of creating an expensive object inside build?

Choose one answer for question 62

Correct answer: B. It is recreated on every rebuild, losing its state and wasting work

Why: Create such objects in initState or a provider, not in build.

64Short answerState managementJunior

Why should you dispose controllers and notifiers?

Answer: Controllers, notifiers, and stream subscriptions hold resources and listeners that leak memory and can fire after a widget is gone if not released. Disposing them in dispose, or using auto-dispose providers, prevents leaks and stale callbacks.

63MCQState managementJunior

What does notifyListeners() trigger?

Choose one answer for question 63

Correct answer: B. A rebuild of widgets listening to that ChangeNotifier

Why: It signals listeners that the model changed so they can rebuild.

Learn Flutter properly: The Complete Flutter Guide — Riverpod, Firebase, REST APIs, animations and more.Get 85% off on Udemy
64MCQState managementSenior

How does Provider help with dependency injection, not just state?

Choose one answer for question 64

Correct answer: B. It exposes services and objects down the tree so widgets read them via context instead of creating them

Why: Providers supply shared services such as repositories and clients to the subtree.

What Flutter lifecycle and rebuild questions should you prepare?

State and app lifecycle callbacks, when build runs, and how to limit rebuilds. 10 MCQs · 10 short answers

65MCQLifecycle & rebuildsJunior

Which State method runs once when the State object is first created?

Choose one answer for question 65

Correct answer: B. initState

Why: initState runs once for one-time setup before the first build.

66MCQLifecycle & rebuildsJunior

Where should you release controllers, listeners, and streams?

Choose one answer for question 66

Correct answer: B. dispose

Why: dispose is the cleanup hook called when the State is permanently removed.

65Short answerLifecycle & rebuildsJunior

Describe the main lifecycle methods of a State object.

Answer: initState runs once when the State is created for one-time setup. didChangeDependencies runs after initState and when inherited dependencies change. build runs whenever the widget must render. didUpdateWidget runs when the parent rebuilds with new configuration. dispose runs once when the State is removed, for cleanup.

66Short answerLifecycle & rebuildsJunior

What belongs in initState versus dispose?

Answer: initState is for one-time setup such as creating controllers, subscribing to streams, or kicking off an initial load. dispose is for tearing those down: disposing controllers, cancelling subscriptions, and removing listeners so nothing leaks.

67MCQLifecycle & rebuildsMid

When is didChangeDependencies called?

Choose one answer for question 67

Correct answer: B. After initState and whenever an inherited dependency the widget uses changes

Why: It runs after initState and when an InheritedWidget it depends on changes.

67Short answerLifecycle & rebuildsMid

When does didChangeDependencies run, and why is it useful?

Answer: It runs right after initState, and again whenever an InheritedWidget the State depends on changes, such as Theme or a Provider. It is the correct place for context-dependent initialisation that is not safe to do in initState.

68Short answerLifecycle & rebuildsMid

What is didUpdateWidget used for?

Answer: It is called when the parent rebuilds and gives the same State a new widget configuration. You use it to react to changed inputs, for example re-subscribing when an id passed into the widget changes, and you can compare oldWidget with the new widget to decide what to do.

68MCQLifecycle & rebuildsMid

What does didUpdateWidget let you respond to?

Choose one answer for question 68

Correct answer: B. The parent rebuilding this widget with a new configuration

Why: Use it to react when the incoming widget configuration changes.

Learn Flutter properly: The Complete Flutter Guide — Riverpod, Firebase, REST APIs, animations and more.Get 85% off on Udemy
69Short answerLifecycle & rebuildsSenior

How do you respond to the app being backgrounded or resumed?

Answer: Implement WidgetsBindingObserver, register it with WidgetsBinding.instance.addObserver, and handle didChangeAppLifecycleState, which reports states like resumed, inactive, paused, and detached. Use it to pause work, save data, or refresh on resume, and remove the observer in dispose.

70Short answerLifecycle & rebuildsMid

Why must you check mounted after an await before calling setState?

Answer: An async gap can outlive the widget, so by the time the Future completes the State may already be disposed. Calling setState on a disposed State throws, so you guard it with a mounted check to avoid the error and skip unnecessary work.

69MCQLifecycle & rebuildsMid

Why should initState avoid BuildContext-dependent calls like MediaQuery.of?

Choose one answer for question 69

Correct answer: B. Inherited widgets are not fully available yet; use didChangeDependencies instead

Why: Context-dependent lookups are safe in didChangeDependencies, not early in initState.

70MCQLifecycle & rebuildsSenior

How do you observe app lifecycle states such as paused and resumed?

Choose one answer for question 70

Correct answer: B. Implement WidgetsBindingObserver and handle didChangeAppLifecycleState

Why: Register a WidgetsBindingObserver to receive app lifecycle callbacks.

71Short answerLifecycle & rebuildsJunior

Why should build be fast and free of side effects?

Answer: build can run many times, even several times per second during animation or scrolling. If it performs heavy work or side effects such as network calls, the app janks and behaves unpredictably, so build should only describe the UI.

72Short answerLifecycle & rebuildsSenior

What causes excessive rebuilds, and how do you diagnose them?

Answer: Common causes are calling setState on a large ancestor, listening to a provider that changes often, or recreating objects inside build. You diagnose them with Flutter DevTools' rebuild profiler and the performance overlay, then narrow the state scope and add const where you can.

71MCQLifecycle & rebuildsJunior

How often can build be called?

Choose one answer for question 71

Correct answer: B. Many times, whenever the widget needs to be rebuilt

Why: build can run frequently, so it must be cheap and side-effect free.

Learn Flutter properly: The Complete Flutter Guide — Riverpod, Firebase, REST APIs, animations and more.Get 85% off on Udemy
73Short answerLifecycle & rebuildsMid

What is the order of initState, didChangeDependencies, and build on first render?

Answer: On first render the order is initState, then didChangeDependencies, then build. initState does setup that does not need context, didChangeDependencies handles inherited dependencies, and build then produces the UI.

74Short answerLifecycle & rebuildsJunior

What happens to a State object when its widget moves in the tree?

Answer: If Flutter can reuse the element, often guided by keys, the same State is preserved and moved with it. If not, the old State is disposed and a new one is created via initState. Keys decide whether Flutter keeps the same element and State across the change.

72MCQLifecycle & rebuildsMid

Why must build be free of side effects?

Choose one answer for question 72

Correct answer: B. Because it may be called many times and should only describe the UI

Why: Side effects in build cause bugs and wasted work due to frequent rebuilds.

73MCQLifecycle & rebuildsSenior

What is the most effective way to reduce unnecessary rebuilds?

Choose one answer for question 73

Correct answer: B. Keep setState scope small, split widgets, and mark stable subtrees const

Why: Localising state and using const limits the part of the tree that rebuilds.

74MCQLifecycle & rebuildsMid

What does mounted tell you in a State object?

Choose one answer for question 74

Correct answer: B. Whether the State is still in the tree, so it is safe to call setState

Why: Check mounted before setState after an await to avoid calling it on a disposed State.

How are async, Futures, Streams, and isolates tested?

async/await, Future vs Stream, FutureBuilder, and offloading work to isolates. 13 MCQs · 13 short answers

75MCQAsync, Futures, Streams & isolatesJunior

What does await do?

Choose one answer for question 75

Correct answer: B. Pauses the async function until the awaited Future completes, without blocking the UI

Why: await suspends the function and resumes when the Future completes.

76MCQAsync, Futures, Streams & isolatesJunior

What is the difference between a Future and a Stream?

Choose one answer for question 76

Correct answer: B. A Future is a single async value; a Stream is a sequence of async events over time

Why: Use Future for one-off results and Stream for repeated or continuous events.

75Short answerAsync, Futures, Streams & isolatesJunior

What is a Future in Dart?

Answer: A Future represents a value that will be available later, the result of an asynchronous operation such as a network call or file read. It completes once, with a value or an error, and you react to it with await, or with .then and .catchError.

76Short answerAsync, Futures, Streams & isolatesJunior

What is a Stream, and how does it differ from a Future?

Answer: A Stream is a sequence of asynchronous events delivered over time that you listen to. Unlike a Future, which yields a single result, a Stream can emit many values, errors, and a done event, which suits user input, sockets, or sensor data.

77MCQAsync, Futures, Streams & isolatesMid

Which widget rebuilds based on the latest snapshot of a Future?

Choose one answer for question 77

Correct answer: B. FutureBuilder

Why: FutureBuilder rebuilds as the Future moves through waiting, done, and error states.

77Short answerAsync, Futures, Streams & isolatesMid

How do you turn a Future into UI with FutureBuilder?

Answer: You give FutureBuilder the Future and a builder. The builder receives an AsyncSnapshot whose connectionState and data or error you inspect to show loading, success, or error UI. Create the Future once outside build so it is not refetched on every rebuild.

78Short answerAsync, Futures, Streams & isolatesMid

How do you consume a Stream in the UI?

Answer: Use a StreamBuilder, which subscribes to the stream and rebuilds with each new snapshot so you can render the latest value, an error, or a waiting state. For non-UI use you call stream.listen and remember to cancel the subscription when done.

Learn Flutter properly: The Complete Flutter Guide — Riverpod, Firebase, REST APIs, animations and more.Get 85% off on Udemy
78MCQAsync, Futures, Streams & isolatesMid

Which widget listens to a Stream and rebuilds on each event?

Choose one answer for question 78

Correct answer: B. StreamBuilder

Why: StreamBuilder rebuilds with each new value emitted by the stream.

79MCQAsync, Futures, Streams & isolatesSenior

Why move heavy JSON parsing to compute or an isolate?

Choose one answer for question 79

Correct answer: B. Because otherwise the work runs on the UI isolate and causes jank

Why: Offloading CPU-heavy work keeps the UI isolate free to render smoothly.

79Short answerAsync, Futures, Streams & isolatesSenior

Explain isolates and how they differ from threads.

Answer: An isolate is an independent worker with its own memory and event loop, and isolates communicate only by passing messages over ports rather than sharing memory. Unlike threads that share memory and need locks, isolates avoid data races by design, which makes Dart concurrency safer but requires copying data between them.

80Short answerAsync, Futures, Streams & isolatesSenior

When and how do you use compute?

Answer: Use compute to run a top-level or static function on a separate isolate for CPU-heavy work such as parsing large JSON or processing images, so the UI isolate stays responsive. You call compute with the function and its argument, and it returns a Future with the result.

80MCQAsync, Futures, Streams & isolatesMid

How do isolates communicate?

Choose one answer for question 80

Correct answer: B. By passing messages over ports; they do not share memory

Why: Isolates exchange data via SendPort and ReceivePort messages.

81Short answerAsync, Futures, Streams & isolatesJunior

What is the difference between .then and await?

Answer: Both handle a Future's result. .then registers a callback that runs when the Future completes and chains further callbacks. await pauses an async function until the Future completes and reads the value inline, which usually reads more clearly. The effect is equivalent.

82Short answerAsync, Futures, Streams & isolatesMid

How do you handle errors in asynchronous code?

Answer: With await, wrap the call in try/catch and use finally for cleanup. With the callback style, use .catchError or the onError argument, and for streams provide an onError handler. Always handle errors so failures surface instead of being silently swallowed.

81MCQAsync, Futures, Streams & isolatesJunior

What does an async* function return?

Choose one answer for question 81

Correct answer: B. A Stream, using yield to emit values

Why: async* generators produce a Stream and emit with yield.

Learn Flutter properly: The Complete Flutter Guide — Riverpod, Firebase, REST APIs, animations and more.Get 85% off on Udemy
83Short answerAsync, Futures, Streams & isolatesMid

What is the difference between async, async*, and sync*?

Answer: async returns a Future for a single asynchronous result. async* returns a Stream and emits values with yield. sync* returns a lazily produced Iterable, also using yield. The starred forms are generators that produce sequences rather than one value.

84Short answerAsync, Futures, Streams & isolatesJunior

What does Future.delayed do, and when is it used?

Answer: Future.delayed returns a Future that completes after a given duration, optionally running a computation afterwards. It is used for simple timed delays, retry backoff, or simulating latency in demos and tests.

82MCQAsync, Futures, Streams & isolatesMid

How do you handle errors from an awaited Future?

Choose one answer for question 82

Correct answer: B. Wrap the await in a try/catch block

Why: Awaited errors are thrown into the function and caught by try/catch.

85Short answerAsync, Futures, Streams & isolatesMid

How do you run several asynchronous operations in parallel?

Answer: Start the Futures without awaiting them one by one, then pass them to Future.wait, which runs them concurrently and completes when all finish, returning the results in order. This is faster than awaiting each in sequence when the operations are independent.

83MCQAsync, Futures, Streams & isolatesMid

What is the difference between a single-subscription and a broadcast stream?

Choose one answer for question 83

Correct answer: B. A single-subscription stream allows one listener; a broadcast stream allows many

Why: Use a broadcast stream when multiple listeners must receive the same events.

84MCQAsync, Futures, Streams & isolatesSenior

Why can the UI still freeze even when you use async/await?

Choose one answer for question 84

Correct answer: B. Because async code runs on the UI isolate; only the awaited gaps yield, so heavy synchronous work between awaits still blocks

Why: async does not create threads, so CPU-bound work must go to an isolate.

Learn Flutter properly: The Complete Flutter Guide — Riverpod, Firebase, REST APIs, animations and more.Get 85% off on Udemy
86Short answerAsync, Futures, Streams & isolatesSenior

Why can heavy work still jank the UI despite using async and await?

Answer: async and await do not create new threads; the code still runs on the UI isolate and only yields at await points. A long synchronous computation between awaits blocks the event loop and the current frame, causing jank. The fix is to move CPU-bound work to another isolate via compute.

87Short answerAsync, Futures, Streams & isolatesSenior

What is the difference between a microtask and an event in Dart's event loop?

Answer: Dart drains the microtask queue completely before handling the next item from the event queue. Microtasks, scheduled via scheduleMicrotask or completed Futures, run sooner; events include I/O, timers, and gestures. Flooding the microtask queue can starve events, so use microtasks sparingly.

85MCQAsync, Futures, Streams & isolatesJunior

What does Future.delayed do?

Choose one answer for question 85

Correct answer: B. Completes after a given duration, useful for simple delays

Why: Future.delayed returns a Future that completes after the specified time.

86MCQAsync, Futures, Streams & isolatesMid

What does Future.wait do?

Choose one answer for question 86

Correct answer: B. Runs multiple Futures concurrently and completes when all have finished

Why: Future.wait awaits a list of Futures in parallel and returns their results.

87MCQAsync, Futures, Streams & isolatesSenior

Why handle a Future explicitly instead of silently not awaiting it?

Choose one answer for question 87

Correct answer: B. An unhandled Future error can go unnoticed, so being explicit surfaces errors and documents intent

Why: Fire-and-forget Futures can swallow errors; handle or unawaited them deliberately.

What Flutter navigation and routing questions come up?

Navigator 1.0 and 2.0, named routes, go_router, deep linking, and passing data back. 12 MCQs · 12 short answers

88MCQNavigation & routingJunior

How do you push a new screen with the imperative Navigator API?

Choose one answer for question 88

Correct answer: B. Navigator.push with a route

Why: Navigator.push puts a new route on top of the stack.

89MCQNavigation & routingJunior

How do you return to the previous screen?

Choose one answer for question 89

Correct answer: B. Navigator.pop

Why: Navigator.pop removes the current route and reveals the one beneath.

88Short answerNavigation & routingJunior

How do you navigate to a new screen and back imperatively?

Answer: You push a route with Navigator.push, passing a MaterialPageRoute that builds the new screen, and you return with Navigator.pop. push adds a route to the stack and pop removes the top one, revealing the previous screen.

89Short answerNavigation & routingMid

What is the difference between Navigator 1.0 and Navigator 2.0?

Answer: Navigator 1.0 is imperative: you push and pop routes directly. Navigator 2.0, the Router API, is declarative: you describe the whole stack as a function of app state, which makes deep linking, web URLs, and complex back-stack control much easier.

90MCQNavigation & routingMid

What is the main difference between Navigator 1.0 and 2.0?

Choose one answer for question 90

Correct answer: B. Navigator 2.0 is declarative and manages the whole stack as state, which suits deep linking and web URLs

Why: 2.0, the Router API, makes navigation a function of app state.

91MCQNavigation & routingMid

Why do many teams use go_router?

Choose one answer for question 91

Correct answer: B. It provides URL-based, declarative routing with deep linking and redirects on top of Navigator 2.0

Why: go_router simplifies the declarative Router API and handles web URLs and deep links.

Learn Flutter properly: The Complete Flutter Guide — Riverpod, Firebase, REST APIs, animations and more.Get 85% off on Udemy
90Short answerNavigation & routingMid

Why do many teams adopt go_router?

Answer: go_router wraps the declarative Router API with a simpler, URL-based configuration. It handles deep links, nested and shell routes, redirects for cases like authentication, and web URLs, removing much of the boilerplate of using Navigator 2.0 directly.

91Short answerNavigation & routingJunior

How do you pass data to a new screen?

Answer: Most often you pass it through the destination widget's constructor when you build the route. With named routes you can instead pass it via RouteSettings.arguments and read it with ModalRoute.of(context).settings.arguments.

92MCQNavigation & routingMid

How can you pass data back to the previous screen when popping?

Choose one answer for question 92

Correct answer: B. Pass a result to Navigator.pop(context, result) and await the pushed route

Why: push returns a Future that completes with the value passed to pop.

92Short answerNavigation & routingMid

How do you get a result back from a pushed screen?

Answer: Navigator.push returns a Future that completes when the pushed route pops. The popped screen passes a value with Navigator.pop(context, result), and the caller awaits the push to receive it, for example to read a selection from a picker screen.

93MCQNavigation & routingJunior

What are named routes?

Choose one answer for question 93

Correct answer: B. Routes registered by string name and navigated to with pushNamed

Why: Named routes map string identifiers to builders for pushNamed.

93Short answerNavigation & routingSenior

How does deep linking work in a Flutter app?

Answer: The platform delivers an incoming URL or intent to the app, and the router translates it into the correct route stack so the user lands on the right screen. With go_router or the Router API you map URL patterns to routes, which also keeps web URLs in sync with navigation state.

94MCQNavigation & routingSenior

What does deep linking require the app to do?

Choose one answer for question 94

Correct answer: B. Map an incoming URL or intent to the correct route stack, often via the Router API or go_router

Why: Deep links translate an external URL into in-app navigation state.

94Short answerNavigation & routingJunior

What are named routes, and how are they declared?

Answer: Named routes map string identifiers to screen builders, declared in MaterialApp's routes table or via onGenerateRoute, and you navigate with Navigator.pushNamed. They centralise route definitions but are less flexible than typed, URL-based routing.

Learn Flutter properly: The Complete Flutter Guide — Riverpod, Firebase, REST APIs, animations and more.Get 85% off on Udemy
95Short answerNavigation & routingMid

What is the difference between push, pushReplacement, and pushAndRemoveUntil?

Answer: push adds a route on top of the stack. pushReplacement swaps the current route for a new one so back does not return to it. pushAndRemoveUntil pushes a route and removes earlier ones up to a condition, which is handy after login to clear the auth flow.

95MCQNavigation & routingMid

How do you pass arguments to a screen you push?

Choose one answer for question 95

Correct answer: B. Through the route, for example constructor arguments or RouteSettings.arguments

Why: Pass data via the widget constructor or settings.arguments.

96MCQNavigation & routingMid

What does pushReplacement do?

Choose one answer for question 96

Correct answer: B. Replaces the current route with a new one so back does not return to it

Why: Use it for flows like login where you should not return to the old screen.

96Short answerNavigation & routingMid

How do you preserve each tab's state in a bottom-navigation layout?

Answer: Keep the tab subtrees alive instead of rebuilding them, for example with an IndexedStack that shows one child while retaining the others, or with go_router's StatefulShellRoute. This preserves scroll position and form state as the user switches tabs.

97MCQNavigation & routingJunior

Why pair a BottomNavigationBar with an IndexedStack?

Choose one answer for question 97

Correct answer: B. To switch between tabs while preserving each tab's state

Why: IndexedStack keeps all tab subtrees alive so their state persists across switches.

98MCQNavigation & routingSenior

Why can nested navigators be useful?

Choose one answer for question 98

Correct answer: B. They let a section such as a tab keep its own independent navigation stack

Why: Nested navigators isolate a sub-flow history, common in tabbed apps.

Learn Flutter properly: The Complete Flutter Guide — Riverpod, Firebase, REST APIs, animations and more.Get 85% off on Udemy
97Short answerNavigation & routingSenior

When and why would you use nested navigators?

Answer: Nested navigators give a section, such as a tab or a multi-step wizard, its own independent navigation stack and back history. This keeps a sub-flow separate from the root, so popping inside a tab does not affect other tabs, which is common in tabbed apps.

98Short answerNavigation & routingJunior

How do you show a modal screen or dialog?

Answer: Use showDialog for a Material dialog, showModalBottomSheet for a bottom sheet, or push a route with fullscreenDialog set to true for a full-screen modal. Each places content above the current screen and returns a Future with any result when dismissed.

99MCQNavigation & routingMid

How does go_router typically handle authentication gating?

Choose one answer for question 99

Correct answer: B. With a redirect callback that sends unauthenticated users to a login route

Why: go_router redirects based on app state such as auth before resolving a route.

99Short answerNavigation & routingMid

How does go_router handle authentication redirects?

Answer: go_router exposes a redirect callback that runs before a route resolves. You inspect app state, such as whether the user is logged in, and return a different location to send unauthenticated users to login, or null to proceed. It centralises route guarding in one place.

What do interviews ask about networking and local storage in Flutter?

http and dio, JSON serialisation, error handling, and shared_preferences vs sqflite vs Hive. 12 MCQs · 12 short answers

100Short answerNetworking, JSON & persistenceJunior

How do you make a simple GET request and decode the response?

Answer: You call http.get with the URL, check the statusCode, then pass response.body to jsonDecode to get a Map or List, and map that into your model. In real apps you also handle errors, timeouts, and non-2xx responses.

100MCQNetworking, JSON & persistenceJunior

Which package is commonly used for basic HTTP requests in Flutter?

Choose one answer for question 100

Correct answer: B. http

Why: The http package provides simple GET, POST, and other request helpers.

101MCQNetworking, JSON & persistenceMid

What does dio add over the basic http package?

Choose one answer for question 101

Correct answer: B. Interceptors, global config, timeouts, cancellation, and easier error handling

Why: dio is a feature-rich client with interceptors and richer configuration.

101Short answerNetworking, JSON & persistenceMid

How do you parse JSON into model objects safely?

Answer: Define a model with a fromJson factory that reads typed fields from the decoded map, or generate it with json_serializable to avoid hand-written mistakes. Centralising parsing in the model keeps the rest of the app working with typed objects rather than dynamic maps.

102Short answerNetworking, JSON & persistenceMid

When would you use dio instead of the http package?

Answer: Use dio when you need more than simple requests: interceptors for auth tokens and logging, global base options and timeouts, request cancellation, retries, and richer error objects. For a small app with a few calls, the http package is enough.

102MCQNetworking, JSON & persistenceJunior

How do you turn a decoded JSON map into a typed Dart object?

Choose one answer for question 102

Correct answer: B. Write a fromJson factory or use code generation such as json_serializable

Why: Dart maps JSON via a fromJson factory or generated serialisation code.

Learn Flutter properly: The Complete Flutter Guide — Riverpod, Firebase, REST APIs, animations and more.Get 85% off on Udemy
103Short answerNetworking, JSON & persistenceJunior

Which local storage option fits simple key-value settings?

Answer: shared_preferences fits small primitive key-value data such as a theme flag, an onboarding-seen boolean, or a username. It is asynchronous and easy to use, but it is not meant for large or structured data.

104Short answerNetworking, JSON & persistenceMid

How do you choose between shared_preferences, sqflite, and Hive?

Answer: Use shared_preferences for small primitive settings, sqflite when you need relational, queryable structured data with SQL, and Hive when you want fast, lightweight object storage without SQL. The choice depends on data size, structure, and your query needs.

103MCQNetworking, JSON & persistenceMid

What does jsonDecode return for a JSON object?

Choose one answer for question 103

Correct answer: B. A Map<String, dynamic>

Why: jsonDecode yields dynamic structures, typically a map for a JSON object.

104MCQNetworking, JSON & persistenceJunior

Which storage suits small key-value preferences such as a theme flag?

Choose one answer for question 104

Correct answer: B. shared_preferences

Why: shared_preferences stores simple primitive key-value pairs.

105Short answerNetworking, JSON & persistenceSenior

Why introduce a repository layer for data access?

Answer: A repository hides where data comes from, whether network, cache, or database, behind one clean interface. The UI and business logic depend only on that interface, which makes it easy to swap implementations, add caching, and test with a fake repository.

105MCQNetworking, JSON & persistenceMid

When would you choose sqflite over shared_preferences?

Choose one answer for question 105

Correct answer: B. For structured, relational, queryable data with many rows

Why: sqflite is a SQLite database suited to structured, queryable data.

Learn Flutter properly: The Complete Flutter Guide — Riverpod, Firebase, REST APIs, animations and more.Get 85% off on Udemy
106Short answerNetworking, JSON & persistenceMid

How should you represent loading, success, and error states for a request?

Answer: Model them explicitly, for example with a sealed class or an AsyncValue, so the UI is forced to handle each case. This avoids ambiguous nulls and forgotten error paths, and makes it simple to show a spinner, the content, or a retry prompt.

107Short answerNetworking, JSON & persistenceJunior

Why should network requests not be triggered directly inside build?

Answer: build can run many times, so a request placed there fires repeatedly and wastes bandwidth and battery. Trigger the request once from initState, an event handler, or a provider, and feed the result into the UI through state.

106MCQNetworking, JSON & persistenceMid

What is Hive typically used for?

Choose one answer for question 106

Correct answer: B. Fast, lightweight local NoSQL storage of objects without SQL

Why: Hive is a fast key-value and object store that avoids SQL boilerplate.

108Short answerNetworking, JSON & persistenceMid

How do you handle request timeouts and retries?

Answer: Set a timeout on the call, for example with .timeout on the Future or via dio's options, and catch it to show an error or retry. For retries, use a limited number of attempts with backoff, and make the operation idempotent so repeats are safe.

107MCQNetworking, JSON & persistenceSenior

Why wrap network results in a sealed result or state type?

Choose one answer for question 107

Correct answer: B. To represent loading, success, and error explicitly so the UI handles every case

Why: Explicit states make loading and error handling exhaustive and predictable.

109Short answerNetworking, JSON & persistenceSenior

How do you keep API keys and secrets out of the codebase?

Answer: Keep secrets out of committed source. Inject them at build time with --dart-define or environment configuration, and store user tokens in secure storage such as flutter_secure_storage. Never hard-code or log secrets, and rotate any that leak.

110Short answerNetworking, JSON & persistenceMid

How do you cache network data for offline or faster access?

Answer: Store fetched data locally in Hive, sqflite, or a file, and read from the cache first while refreshing in the background. A repository is a natural place for this cache-then-network strategy, and you add timestamps or invalidation rules to keep the data fresh.

108MCQNetworking, JSON & persistenceMid

Which HTTP status range indicates a successful response?

Choose one answer for question 108

Correct answer: B. 2xx

Why: 2xx codes indicate success; 4xx are client errors and 5xx server errors.

Learn Flutter properly: The Complete Flutter Guide — Riverpod, Firebase, REST APIs, animations and more.Get 85% off on Udemy
111Short answerNetworking, JSON & persistenceJunior

What does jsonEncode do, and when do you use it?

Answer: jsonEncode converts a Dart structure of maps, lists, and primitives, typically a model's toJson output, into a JSON string. You use it when sending data in a request body or saving structured data as text.

109MCQNetworking, JSON & persistenceJunior

Why should network calls not run directly inside build?

Choose one answer for question 109

Correct answer: B. build runs often, so the call would fire repeatedly; trigger it from initState, an event, or a provider

Why: Frequent rebuilds would re-fire the request, so start it once outside build.

110MCQNetworking, JSON & persistenceSenior

What is the benefit of a repository layer between the UI and data sources?

Choose one answer for question 110

Correct answer: B. It hides data-source details and gives the UI one clean, testable API

Why: A repository abstracts network and cache sources behind a single interface.

111MCQNetworking, JSON & persistenceMid

How do you usually keep an API token out of source code?

Choose one answer for question 111

Correct answer: B. Load it from secure storage or build-time configuration, not committed code

Why: Secrets belong in secure storage or build config, never in committed code.

Which Flutter animation questions are common?

Implicit vs explicit animations, AnimationController, Tween, and Hero transitions. 10 MCQs · 10 short answers

112Short answerAnimationsJunior

What is the difference between implicit and explicit animations?

Answer: Implicit animations, such as AnimatedContainer or AnimatedOpacity, animate automatically whenever you give them new target values over a duration. Explicit animations use an AnimationController that you start, stop, and drive yourself, giving fine control over timing, repetition, and direction.

113Short answerAnimationsMid

What is the role of an AnimationController?

Answer: An AnimationController produces values, usually from 0 to 1, over a duration, ticking once per frame via a vsync provider. You drive animations from it, often mapping its value through a Tween and a Curve, and you must dispose it when the widget is removed.

112MCQAnimationsJunior

What is the difference between implicit and explicit animations?

Choose one answer for question 112

Correct answer: B. Implicit animations such as AnimatedContainer tween automatically to new values; explicit ones use an AnimationController you drive

Why: Implicit widgets tween to new values for you; explicit ones give manual control.

113MCQAnimationsMid

What does an AnimationController need to function?

Choose one answer for question 113

Correct answer: B. A vsync ticker provider, usually via a TickerProviderStateMixin

Why: The controller drives per-frame values using a vsync ticker.

114Short answerAnimationsMid

What does a Tween do, and how is it combined with a controller?

Answer: A Tween defines a begin and end value of any type, such as colours or offsets, and interpolates between them. You attach it to an AnimationController, often via animate, so as the controller runs from 0 to 1 the Tween produces the in-between values.

115Short answerAnimationsJunior

How do you animate a property change with the least code?

Answer: Use an implicit animation widget like AnimatedContainer, AnimatedOpacity, or AnimatedPositioned and change its target values inside setState. Flutter tweens from the old value to the new one over the given duration and curve automatically.

114MCQAnimationsMid

What is a Tween used for?

Choose one answer for question 114

Correct answer: B. Defining the range of values an animation interpolates between

Why: A Tween maps the controller 0 to 1 value onto a begin and end range.

Learn Flutter properly: The Complete Flutter Guide — Riverpod, Firebase, REST APIs, animations and more.Get 85% off on Udemy
115MCQAnimationsJunior

Which widget animates between values automatically when its properties change?

Choose one answer for question 115

Correct answer: B. AnimatedContainer

Why: AnimatedContainer tweens to new values over a duration implicitly.

116Short answerAnimationsMid

What is a Hero animation, and how do you set one up?

Answer: A Hero animation flies a shared element between two routes during navigation. You wrap the element on both screens in a Hero with the same tag, and Flutter animates its size and position from the source to the destination as the route transitions.

116MCQAnimationsMid

What does a Hero widget do?

Choose one answer for question 116

Correct answer: B. Animates a shared-element transition between two routes

Why: Matching Hero tags animate an element flying between screens.

117MCQAnimationsSenior

Why must you dispose an AnimationController?

Choose one answer for question 117

Correct answer: B. To stop its ticker and free resources, preventing leaks

Why: An undisposed controller keeps ticking and leaks memory.

117Short answerAnimationsSenior

How do you build a staggered animation?

Answer: Drive several Tweens from a single AnimationController, giving each one an Interval curve that defines the slice of the 0-to-1 timeline during which it animates. By offsetting these intervals, the properties start and finish at different times to create a staggered effect.

118MCQAnimationsMid

What is the role of a CurvedAnimation?

Choose one answer for question 118

Correct answer: B. It applies an easing curve to an animation value for non-linear motion

Why: CurvedAnimation maps linear progress through an easing curve.

118Short answerAnimationsMid

What does a CurvedAnimation add?

Answer: A CurvedAnimation applies an easing curve, such as Curves.easeInOut, to a linear animation so motion accelerates and decelerates naturally. You wrap the controller in a CurvedAnimation and drive your Tween from that instead of the raw linear value.

119Short answerAnimationsJunior

Which widget rebuilds efficiently as an animation runs?

Answer: AnimatedBuilder, or ListenableBuilder, rebuilds only the part of the tree returned by its builder on each tick, while you keep the rest static via the child parameter. This avoids rebuilding the whole widget every frame.

Learn Flutter properly: The Complete Flutter Guide — Riverpod, Firebase, REST APIs, animations and more.Get 85% off on Udemy
119MCQAnimationsJunior

Which widget fades a child as its opacity changes over time?

Choose one answer for question 119

Correct answer: A. AnimatedOpacity

Why: AnimatedOpacity implicitly animates opacity changes.

120MCQAnimationsSenior

How do you run several animations with different timings from one controller?

Choose one answer for question 120

Correct answer: B. Use Interval curves and multiple Tweens driven by one controller, a staggered animation

Why: Staggered animations assign each Tween an Interval of the controller timeline.

120Short answerAnimationsSenior

Why must AnimationControllers be disposed, and where?

Answer: An AnimationController keeps a ticker running and holds listeners, so if it is not disposed it leaks memory and may call back into a removed widget. You dispose it in the State's dispose method, the same place you release other controllers.

121Short answerAnimationsMid

How do you repeat or reverse an animation?

Answer: AnimationController offers forward, reverse, and repeat methods; repeat loops the animation and can reverse each cycle. You can also listen to status changes to chain or reverse at the ends, which drives looping effects like pulsing or spinners.

121MCQAnimationsMid

Why prefer AnimatedBuilder or ListenableBuilder for explicit animations?

Choose one answer for question 121

Correct answer: B. They rebuild only the animating subtree each tick rather than the whole widget

Why: Scoping the rebuild keeps the animation cheap and smooth.

What Flutter testing questions should you expect?

Unit, widget, integration, and golden tests, plus mocking and the test pyramid. 12 MCQs · 12 short answers

122MCQTestingJunior

What does a unit test verify in Flutter?

Choose one answer for question 122

Correct answer: B. A single function, method, or class in isolation

Why: Unit tests check logic in isolation without the widget tree.

122Short answerTestingJunior

What are the three main kinds of tests in Flutter?

Answer: Unit tests check a single function or class in isolation. Widget tests build a widget in a test harness and verify its rendering and interaction without a full app. Integration tests run the whole app on a device or emulator to verify end-to-end flows.

123MCQTestingJunior

What is a widget test?

Choose one answer for question 123

Correct answer: B. A test that builds a widget in a test environment and interacts with it without the full app

Why: Widget tests pump a widget and assert on its rendered output and behaviour.

124MCQTestingMid

Which call builds a widget in a widget test?

Choose one answer for question 124

Correct answer: B. tester.pumpWidget

Why: pumpWidget mounts the widget into the test harness.

123Short answerTestingJunior

How do you write a basic unit test?

Answer: In a file under the test directory you use the test function, set up inputs, call the code under test, and assert the result with expect and a matcher. You group related tests with group and share setup with setUp and tearDown.

125MCQTestingMid

What does tester.pump do after an interaction?

Choose one answer for question 125

Correct answer: B. Advances the clock and rebuilds so you can settle frames and animations

Why: pump triggers a frame; pumpAndSettle runs until animations finish.

124Short answerTestingMid

How does a widget test work?

Answer: You use testWidgets, call tester.pumpWidget to mount the widget, interact with methods like tap and enterText, call pump or pumpAndSettle to advance frames, and assert with expect and Finders such as find.text. It runs quickly without a real device.

Learn Flutter properly: The Complete Flutter Guide — Riverpod, Firebase, REST APIs, animations and more.Get 85% off on Udemy
126MCQTestingMid

What is the purpose of a golden test?

Choose one answer for question 126

Correct answer: B. To compare rendered pixels against a stored reference image

Why: Golden tests catch unintended visual changes through image comparison.

125Short answerTestingMid

What is the difference between pump and pumpAndSettle?

Answer: pump schedules a single frame and advances the clock by an optional duration, which is useful for stepping through animations. pumpAndSettle repeatedly pumps until no frames are scheduled, so it waits for animations and transitions to finish before you assert.

127MCQTestingSenior

What does the integration_test package add over widget tests?

Choose one answer for question 127

Correct answer: B. It runs the full app on a real device or emulator to verify end-to-end flows

Why: Integration tests exercise the whole app, including platform behaviour.

128MCQTestingJunior

How do you locate a widget in a test?

Choose one answer for question 128

Correct answer: B. With a Finder such as find.text or find.byKey

Why: Finders like find.text and find.byType select widgets to assert on.

126Short answerTestingMid

What are golden tests, and when are they useful?

Answer: Golden tests render a widget and compare the output pixels against a stored reference image, failing if they differ. They are useful for catching unintended visual regressions in components or themes, and you regenerate the goldens deliberately when a change is intended.

127Short answerTestingSenior

What does the integration_test package give you over widget tests?

Answer: integration_test runs the complete app on a real device or emulator, exercising real navigation, platform plugins, and performance, so it verifies end-to-end user journeys. Widget tests are faster and isolated, while integration tests catch issues that only appear in the assembled app.

129MCQTestingMid

Why use mocks or fakes in tests?

Choose one answer for question 129

Correct answer: B. To replace real dependencies such as the network so tests are fast, deterministic, and isolated

Why: Mocks isolate the unit under test from slow or non-deterministic dependencies.

130MCQTestingSenior

What shape does a healthy test pyramid have?

Choose one answer for question 130

Correct answer: B. Many fast unit tests, fewer widget tests, and a few integration tests

Why: A broad base of unit tests with fewer slow end-to-end tests keeps suites fast.

Learn Flutter properly: The Complete Flutter Guide — Riverpod, Firebase, REST APIs, animations and more.Get 85% off on Udemy
128Short answerTestingJunior

How do you find and interact with widgets in a test?

Answer: You use Finders such as find.text, find.byType, and find.byKey to locate widgets, then act with tester.tap, tester.enterText, or tester.drag. After acting you pump a frame and assert the resulting state with expect.

129Short answerTestingMid

Why and how do you use mocks in tests?

Answer: You replace real dependencies, such as a network client or repository, with mocks or fakes so tests are fast, deterministic, and focused on the unit under test. Packages like mocktail or mockito let you stub return values and verify that methods were called.

131MCQTestingMid

How do you assert that a widget appears exactly once?

Choose one answer for question 131

Correct answer: B. expect(finder, findsOneWidget)

Why: findsOneWidget matches exactly one widget for the finder.

132MCQTestingJunior

Where do Flutter tests live by default?

Choose one answer for question 132

Correct answer: B. In the test/ directory

Why: Test files live under test/ and run with flutter test.

130Short answerTestingSenior

What is the testing pyramid, and why follow it?

Answer: The pyramid recommends many fast unit tests at the base, fewer widget tests in the middle, and a small number of slower integration tests at the top. Following it keeps the suite fast and reliable while still covering real user flows.

131Short answerTestingMid

How do you test asynchronous code and streams?

Answer: For Futures you make the test async and await the result, or use expectLater with the completion matcher. For streams you use expectLater with emitsInOrder and related matchers. You can also use fakeAsync to control time deterministically.

133MCQTestingSenior

Why test business logic separately from widgets?

Choose one answer for question 133

Correct answer: B. Isolated logic tests are faster and more stable, which is easier when state is decoupled via BLoC or Riverpod

Why: Decoupled logic enables fast, UI-independent unit tests.

132Short answerTestingJunior

Where do test files live, and how do you run them?

Answer: Test files live in the test directory and usually end with _test.dart, and you run them with flutter test, optionally targeting a single file or a test by name. Integration tests live in the integration_test directory and run on a device or emulator.

Learn Flutter properly: The Complete Flutter Guide — Riverpod, Firebase, REST APIs, animations and more.Get 85% off on Udemy
133Short answerTestingSenior

How does decoupling logic from the UI improve testability?

Answer: When business logic lives in plain classes, BLoCs, or Riverpod notifiers rather than inside widgets, you can unit test it quickly without pumping widgets or using a device. The UI then becomes a thin layer covered by a few widget tests, keeping the suite fast and stable.

How do Flutter performance interview questions work?

Impeller, const constructors, RepaintBoundary, DevTools, and cutting rebuild cost. 11 MCQs · 11 short answers

134Short answerPerformanceJunior

Why does using const widgets improve performance?

Answer: A const widget is created once at compile time and is canonicalised, so Flutter can skip rebuilding and re-laying-out that subtree because the instance never changes. Marking stable widgets const reduces work and allocations on every frame.

134MCQPerformanceJunior

Why mark widgets const where possible?

Choose one answer for question 134

Correct answer: B. Const widgets are created once at compile time and skip rebuilds, reducing work

Why: Const subtrees are canonicalised and need no rebuild or re-layout.

135MCQPerformanceMid

What is Impeller?

Choose one answer for question 135

Correct answer: B. Flutter's rendering engine that precompiles shaders to avoid first-run shader jank

Why: Impeller replaces the old runtime shader compilation that caused early-frame jank.

135Short answerPerformanceMid

What is Impeller, and what problem does it solve?

Answer: Impeller is Flutter's modern rendering engine that precompiles shaders ahead of time instead of compiling them at runtime. This removes the shader-compilation jank that previously caused stutter the first time an animation or effect ran.

136Short answerPerformanceMid

How does RepaintBoundary help performance?

Answer: RepaintBoundary puts a subtree on its own compositing layer, so when that subtree repaints, for example during an animation, the rest of the screen is not repainted with it. Placed around frequently repainting widgets, it cuts wasted paint work.

136MCQPerformanceMid

What does RepaintBoundary do?

Choose one answer for question 136

Correct answer: B. Isolates a subtree onto its own layer so its repaints do not affect the rest

Why: It limits repaint work to the bounded subtree, for example around an animating widget.

137Short answerPerformanceSenior

How do you profile and fix jank in a Flutter app?

Answer: Run in profile mode and use Flutter DevTools' performance view and rebuild profiler to find slow frames and frequent rebuilds, plus the performance overlay to watch UI and raster thread times. Then narrow setState scope, add const, isolate repaints, and move heavy work off the UI isolate.

138Short answerPerformanceMid

Why is ListView.builder important for long lists?

Answer: ListView.builder lazily builds only the items near the viewport rather than all of them up front, so memory use and build time stay bounded no matter how long the list is. This keeps scrolling smooth for large or infinite data sets.

Learn Flutter properly: The Complete Flutter Guide — Riverpod, Firebase, REST APIs, animations and more.Get 85% off on Udemy
137MCQPerformanceSenior

Which tool helps you find expensive rebuilds and jank?

Choose one answer for question 137

Correct answer: B. Flutter DevTools, including the performance and rebuild profilers

Why: DevTools shows frame timings, rebuild counts, and the timeline.

138MCQPerformanceMid

Why use ListView.builder for long lists?

Choose one answer for question 138

Correct answer: B. It builds only on-screen items, avoiding the cost of building everything at once

Why: Lazy building keeps memory and build time bounded for long lists.

139Short answerPerformanceJunior

What is the frame budget for smooth scrolling?

Answer: For 60fps you have about 16 milliseconds per frame to handle build, layout, and paint, and even less on 90 or 120Hz screens. Work that overruns the budget drops frames and causes visible jank, so per-frame work must stay light.

140Short answerPerformanceMid

How does narrowing setState scope reduce rebuild cost?

Answer: If you call setState on a small, dedicated widget that holds only the changing state, Flutter rebuilds just that widget instead of a large ancestor subtree. Splitting widgets and keeping state local therefore limits how much of the tree is rebuilt each change.

139MCQPerformanceSenior

What is the frame budget for a smooth 60fps app?

Choose one answer for question 139

Correct answer: B. About 16ms per frame

Why: 60fps leaves roughly 16ms per frame for build, layout, and paint.

140MCQPerformanceMid

How does narrowing setState scope help performance?

Choose one answer for question 140

Correct answer: B. Only the smallest widget holding the changing state rebuilds, not a large subtree

Why: Smaller stateful widgets limit the rebuilt portion of the tree.

141Short answerPerformanceSenior

How do you reduce image-related memory and jank?

Answer: Decode images at the size you actually display using cacheWidth and cacheHeight, cache them with a package like cached_network_image, and avoid loading full-resolution assets into small widgets. This cuts decode time and memory pressure that otherwise cause jank.

Learn Flutter properly: The Complete Flutter Guide — Riverpod, Firebase, REST APIs, animations and more.Get 85% off on Udemy
141MCQPerformanceJunior

What does cacheExtent on a scrollable affect?

Choose one answer for question 141

Correct answer: B. How much off-screen content is kept built to smooth scrolling

Why: A larger cacheExtent pre-builds nearby off-screen items for smoother scrolling.

142Short answerPerformanceMid

Why avoid expensive work inside the build method?

Answer: build can run many times per second, so heavy computation, allocation, or I/O there is repeated and wastes the frame budget. Move such work to initState, a provider, a memoised value, or another isolate, and keep build to describing the UI.

142MCQPerformanceMid

Why avoid Opacity for frequently changing transparency?

Choose one answer for question 142

Correct answer: B. It can force an offscreen buffer; prefer AnimatedOpacity or fading at paint time

Why: Opacity can trigger costly layer compositing, so cheaper alternatives are preferred.

143Short answerPerformanceJunior

What does the Flutter performance overlay show?

Answer: The performance overlay draws two graphs, one for the UI thread and one for the raster thread, showing how long each frame takes. Bars that cross the threshold mark dropped frames, helping you see when and where the app janks.

143MCQPerformanceSenior

How do you reduce startup jank from large images?

Choose one answer for question 143

Correct answer: B. Resize and cache images, set cacheWidth/cacheHeight, and lazy-load where possible

Why: Decoding right-sized images cuts memory and decode time at startup.

144Short answerPerformanceSenior

When do you use RepaintBoundary versus splitting widgets to cut rebuilds?

Answer: Splitting widgets and localising state reduces rebuild work, which is build and layout. RepaintBoundary reduces repaint work by isolating a layer. They target different phases, so use widget splitting and const for rebuild-heavy cases and RepaintBoundary for paint-heavy, frequently animating areas.

144MCQPerformanceMid

What does the performance overlay show?

Choose one answer for question 144

Correct answer: B. The UI and raster thread frame timings as graphs to spot jank

Why: The overlay graphs UI and raster thread times so slow frames are visible.

What architecture questions do senior Flutter interviews ask?

Feature-first structure, layering, MVVM/clean, and dependency injection choices. 9 MCQs · 9 short answers

145Short answerArchitecture & dependency injectionMid

What is a feature-first folder structure, and why use it?

Answer: Feature-first organises code into a folder per feature, each holding that feature's UI, state, and data, rather than grouping all widgets, models, and services separately. It keeps related code together, scales better as the app grows, and makes features easier to find and remove.

146Short answerArchitecture & dependency injectionSenior

Describe a layered architecture for a Flutter app.

Answer: A common layering is presentation (widgets and view models or BLoCs), domain (entities and use cases or business rules), and data (repositories and data sources). Dependencies point inward toward the domain, so UI and data details can change without affecting the core logic, which also improves testability.

145MCQArchitecture & dependency injectionMid

What is a feature-first project structure?

Choose one answer for question 145

Correct answer: B. Organising code by feature folders rather than by technical layer

Why: Feature-first keeps related UI, state, and data for a feature together.

146MCQArchitecture & dependency injectionSenior

What problem does a layered presentation, domain, and data architecture solve?

Choose one answer for question 146

Correct answer: B. It separates concerns so UI, business rules, and data sources can change independently

Why: Clear layers keep dependencies pointing inward and make code testable.

147Short answerArchitecture & dependency injectionMid

What does the MVVM pattern look like in Flutter?

Answer: In MVVM the view is the widget, the view model holds presentation state and exposes it, often via a ChangeNotifier or Riverpod notifier, and the model or repository supplies data. The view binds to the view model and rebuilds on changes, which keeps UI and logic separate.

147MCQArchitecture & dependency injectionMid

In MVVM for Flutter, what is the view model responsible for?

Choose one answer for question 147

Correct answer: B. Holding presentation state and exposing it to the view, separate from business logic

Why: The view model adapts domain data into state the view binds to.

Learn Flutter properly: The Complete Flutter Guide — Riverpod, Firebase, REST APIs, animations and more.Get 85% off on Udemy
148MCQArchitecture & dependency injectionMid

What is dependency injection?

Choose one answer for question 148

Correct answer: B. Supplying a class its dependencies from outside rather than creating them internally

Why: DI decouples classes from how their collaborators are built, which aids testing.

148Short answerArchitecture & dependency injectionMid

What is dependency injection, and why does it matter?

Answer: Dependency injection means giving a class its collaborators from outside instead of creating them internally. It decouples classes from concrete implementations, which makes code easier to test by substituting fakes and easier to reconfigure, such as swapping a real API for a mock.

149MCQArchitecture & dependency injectionSenior

Why depend on abstractions rather than concrete classes?

Choose one answer for question 149

Correct answer: B. It lets you swap implementations, such as a fake repository in tests, without changing callers

Why: Programming to interfaces enables substitution and testability.

150MCQArchitecture & dependency injectionJunior

Why separate UI widgets from business logic?

Choose one answer for question 150

Correct answer: B. So logic can be tested and reused independently of the UI

Why: Separation makes logic unit-testable and the UI simpler.

149Short answerArchitecture & dependency injectionSenior

Why program to interfaces rather than concrete classes?

Answer: Depending on an abstraction lets you swap implementations without changing callers, for instance using a fake repository in tests or switching data sources. It reduces coupling and supports the dependency inversion principle, keeping high-level logic independent of low-level details.

150Short answerArchitecture & dependency injectionJunior

Why separate business logic from widgets?

Answer: Keeping logic out of widgets makes it reusable and testable on its own and keeps widgets focused on presentation. It avoids bloated build methods, reduces duplication, and lets the logic and the UI change independently.

Learn Flutter properly: The Complete Flutter Guide — Riverpod, Firebase, REST APIs, animations and more.Get 85% off on Udemy
151MCQArchitecture & dependency injectionMid

What is the role of a service or repository class?

Choose one answer for question 151

Correct answer: B. To encapsulate access to a data source or capability behind a clean API

Why: It centralises data access so the rest of the app depends on one interface.

151Short answerArchitecture & dependency injectionMid

What belongs in a repository, and what does it depend on?

Answer: A repository encapsulates data access for a domain area behind a clean interface, coordinating data sources such as a remote API and a local cache. It returns domain models, depends on abstractions of its data sources, and shields the rest of the app from those details.

152MCQArchitecture & dependency injectionSenior

What is a common downside of over-engineering architecture early?

Choose one answer for question 152

Correct answer: B. Excessive layers and boilerplate slow delivery before the app needs them

Why: Add abstraction when the codebase earns it, not pre-emptively.

152Short answerArchitecture & dependency injectionSenior

What is the risk of over-engineering architecture too early?

Answer: Adding many layers, abstractions, and boilerplate before the app needs them slows development, makes simple changes harder, and can confuse new contributors. A pragmatic approach starts simple and introduces structure as complexity and team size genuinely demand it.

153Short answerArchitecture & dependency injectionMid

Which tools are commonly used for dependency injection in Flutter?

Answer: get_it provides a service locator, often combined with injectable for code generation, while Riverpod offers providers that double as DI plus state management, and Provider can inject dependencies down the tree. The choice depends on whether you prefer a locator or a provider-based approach.

153MCQArchitecture & dependency injectionMid

Which packages are commonly used for service location or DI in Flutter?

Choose one answer for question 153

Correct answer: B. get_it, injectable, or Riverpod providers

Why: get_it with injectable, and Riverpod, are common DI approaches in Flutter.

What do interviews ask about Flutter platform channels and releasing apps?

Platform channels, FFI, flavors, build modes, and shipping to the App Store and Play. 7 MCQs · 7 short answers

154Short answerPlatform integration & releaseMid

What is a platform channel, and when do you need one?

Answer: A platform channel is a typed message bridge between Dart and native code, Kotlin or Swift, used when a feature is only available through a platform API or an existing native SDK with no Flutter plugin. You send method calls and arguments across it and receive results asynchronously.

154MCQPlatform integration & releaseMid

What is a platform channel used for?

Choose one answer for question 154

Correct answer: B. Communicating between Dart and native Kotlin or Swift code via messages

Why: Platform channels pass method calls and data between Flutter and the host platform.

155MCQPlatform integration & releaseSenior

When would you use FFI instead of a platform channel?

Choose one answer for question 155

Correct answer: B. To call C or native libraries directly and synchronously for performance

Why: dart:ffi binds native C libraries directly, avoiding channel overhead.

155Short answerPlatform integration & releaseSenior

When would you use dart:ffi instead of a platform channel?

Answer: Use dart:ffi to call C or C++ libraries directly and synchronously, which avoids the asynchronous message overhead of a channel and suits performance-critical native code or reusing existing C libraries. Channels remain better for talking to platform-specific Java, Kotlin, or Swift APIs.

156MCQPlatform integration & releaseJunior

What is the difference between debug and release build modes?

Choose one answer for question 156

Correct answer: B. Debug enables hot reload and assertions; release is AOT-compiled and optimised

Why: Release builds are AOT-compiled and stripped of debug tooling for speed.

157MCQPlatform integration & releaseMid

What are build flavors used for?

Choose one answer for question 157

Correct answer: B. Building variants such as dev, staging, and production with different config from one codebase

Why: Flavors produce separate app variants with their own config and identifiers.

156Short answerPlatform integration & releaseJunior

What is the difference between debug, profile, and release builds?

Answer: Debug builds use JIT compilation, enable hot reload and assertions, and are slower. Profile builds are optimised but keep some tooling for performance analysis. Release builds are AOT-compiled, fully optimised, and stripped of debugging aids, and are what you ship to stores.

157Short answerPlatform integration & releaseMid

What are build flavors, and why use them?

Answer: Flavors let you build distinct variants of the app, such as dev, staging, and production, from one codebase, each with its own application id, name, icons, and configuration like API endpoints. This avoids separate projects and lets the variants coexist on a device.

Learn Flutter properly: The Complete Flutter Guide — Riverpod, Firebase, REST APIs, animations and more.Get 85% off on Udemy
158MCQPlatform integration & releaseMid

Which artefact do you typically upload to the Google Play Store?

Choose one answer for question 158

Correct answer: B. An Android App Bundle (.aab)

Why: Play prefers the .aab bundle, from which it generates optimised APKs.

158Short answerPlatform integration & releaseMid

What do you upload to the Play Store and the App Store?

Answer: For Google Play you upload an Android App Bundle, an .aab, from which Play generates optimised APKs per device. For the App Store you archive an iOS build in Xcode and upload it to App Store Connect, usually via Xcode or Transporter, then submit it for review.

159MCQPlatform integration & releaseSenior

Why build with --obfuscate and --split-debug-info?

Choose one answer for question 159

Correct answer: B. To obfuscate Dart symbols while keeping symbol files that de-obfuscate crash traces

Why: Obfuscation protects code while split debug info lets you read stack traces.

160MCQPlatform integration & releaseJunior

What does the iOS release flow produce before App Store submission?

Choose one answer for question 160

Correct answer: B. A build you archive and upload via Xcode or Transporter

Why: iOS release goes through an Xcode archive uploaded to App Store Connect.

159Short answerPlatform integration & releaseSenior

How do you make release builds smaller and protect the code?

Answer: Build app bundles so stores ship device-specific APKs, enable resource shrinking and tree shaking, compress or right-size assets, and split native libraries per ABI. Use --obfuscate with --split-debug-info to obfuscate Dart symbols while keeping symbol files that de-obfuscate crash reports.

160Short answerPlatform integration & releaseJunior

What basic steps prepare an app for store release?

Answer: Set the app name, application id or bundle id, version, and icons, switch to release signing with your keystore or certificates, remove debug code and test endpoints, build the release artefact, and test it on real devices before submitting through Play Console or App Store Connect.

Related Flutter guides on this site

For further reading, compare the answers with the official Flutter documentation, Dart language guides, Flutter's DevTools docs, build modes, platform channels, and Dart obfuscation guidance.