Skip to content
tezvyn:

Top 30 Intermediate Flutter & Dart Concepts Quiz

30 intermediate multiple-choice Flutter & Dart concept questions, the mechanics underneath the basics: how the pieces relate and where the usual mental model stops holding. They come from 30 bites in the Flutter & Dart library, the middle slice of the 167 Flutter & Dart concept questions in the library. Answer them here or read straight down. Every question carries the correct option, why it is correct, and a link to the bite it came from.

Flutter framework, Dart language, packages, Impeller

30 questions. Pick an answer, or open “Show the answer” to read it.

Answers are graded in your browser. Nothing is saved, and no XP or streak is earned here. The app keeps score.

  1. Question 1 of 30

    You need to store a collection of unique product SKUs that are currently in stock and frequently check if a particular SKU is available. Which Dart collection is the most efficient choice for this task?

    Show the answer

    Answer: a · Set, because it guarantees uniqueness and optimizes for fast existence checks.

    Set is specifically designed for storing unique items and provides highly efficient checks for an item's existence, making it ideal for this scenario. While a Map can also provide fast lookups, a Set is the most direct and efficient choice when only uniqueness and existence checking are required, without needing to associate a value.

    Read the full bite: Dart Collections: Choosing List, Set, or Map

  2. Question 2 of 30

    How does Dart's sound null safety fundamentally alter variable nullability?

    Show the answer

    Answer: b · Variables are non-nullable by default, requiring explicit opt-in for nullability.

    Dart's sound null safety makes variables non-nullable by default, meaning they are guaranteed to hold a value. To allow a variable to be null, developers must explicitly opt-in by adding a '?' to its type. Option D describes the opposite behavior, which is common in many other languages but not Dart with null safety.

    Read the full bite: Dart's Sound Null Safety: No More Null Errors

  3. Question 3 of 30

    Which statement accurately describes the primary function of Dart's null-aware access operator (?. )?

    Show the answer

    Answer: a · It safely attempts to access a member, returning null if the object itself is null.

    The null-aware access operator (?. ) safely checks if an object is null before attempting to access its members. If the object is null, the expression short-circuits and returns null, preventing a runtime error. Option D describes the if-null operator (??), and Option C describes the unsafe not-null assertion operator (!).

    Read the full bite: Dart's Null-Aware Operators: Safely Handle Nulls

  4. Question 4 of 30

    When using Dart's cascade notation (..), what is a crucial difference compared to standard method chaining (.)?

    Show the answer

    Answer: c · The entire cascade expression evaluates to the original object, not the result of the last operation.

    The card explicitly states that the cascade expression gives back the original object, not the result of the final task, which is the crucial difference from standard method chaining. Option B is incorrect because cascade notation modifies the original object in place and returns it, rather than creating a new one.

    Read the full bite: Dart's Cascade Notation: Chain Calls on One Object

  5. Question 5 of 30

    What is the most direct consequence of calling an `async` function in Dart without using the `await` keyword?

    Show the answer

    Answer: a · The variable assigned the result will hold a `Future` object instead of the completed value.

    The card explicitly states that forgetting `await` results in receiving a `Future` object instead of the actual data, which can lead to downstream type errors. The `async` function itself still executes non-blockingly, and it doesn't immediately throw an exception or prevent execution.

    Read the full bite: Dart's async/await: Non-Blocking Code That Reads Synchronously

  6. Question 6 of 30

    What is the primary benefit of Dart's `map()` and `where()` methods being lazy?

    Show the answer

    Answer: b · They reduce memory consumption by avoiding the creation of temporary intermediate lists.

    Lazy `map()` and `where()` methods defer computation until elements are actually requested, which prevents the creation of new, temporary lists for each step in a chain of operations. This significantly reduces memory overhead, especially for large datasets. Option C is incorrect because lazy iterables re-evaluate their operations each time they are iterated, unless explicitly materialized with `.toList()`.

    Read the full bite: Dart's Lazy Iterable Methods: map() and where()

  7. Question 7 of 30

    Which Dart constructor type is best suited for implementing a singleton pattern that returns a cached instance?

    Show the answer

    Answer: a · A factory constructor

    A factory constructor is designed to return an existing instance (e.g., from a cache) or a new one based on logic, making it ideal for singleton patterns. Named constructors always create new instances, and constant constructors focus on compile-time immutability and canonical instances, not runtime caching of a single instance.

    Read the full bite: Dart's Specialized Constructors: Named, Factory, and Constant

  8. Question 8 of 30

    Which Dart feature is best suited for defining an API contract that multiple unrelated classes must adhere to, without forcing them to inherit any shared implementation?

    Show the answer

    Answer: d · A regular class used as an implicit interface, implemented with the 'implements' keyword.

    An implicit interface, created from any regular class and used with 'implements', forces a class to provide its own implementation for every public member, ensuring an API contract without inheriting code. While an abstract class can define a contract (Option C), the card advises against using it if no code is shared, preferring a regular class as an interface for pure contracts.

    Read the full bite: Dart: Abstract Classes & Implicit Interfaces

  9. Question 9 of 30

    If a custom class overrides operator== but not hashCode, what is the primary consequence when its instances are used in a Set or as Map keys?

    Show the answer

    Answer: b · Hash-based collections may fail to correctly identify equal objects, leading to unexpected behavior like duplicates or missing elements.

    The core contract states that if two objects are equal by operator==, they must have the same hashCode. If hashCode is not overridden, two logically equal objects might have different hash codes, causing hash-based collections to treat them as distinct. This is a runtime logical error, not a compile-time error.

    Read the full bite: Why hashCode and operator== Must Be Overridden Together

  10. Question 10 of 30

    What core problem do Dart's enhanced enums primarily solve?

    Show the answer

    Answer: c · They integrate specific data and methods directly into each enumerated value.

    Enhanced enums allow data and behavior to be bundled directly with each enum case, preventing scattered logic that previously required external maps or extension methods. They do not support dynamic creation of instances, mutability of fields, or inheritance, as they are sealed classes with a fixed set of constant instances and final fields.

    Read the full bite: Dart's Enhanced Enums: More Than Just Constants

  11. Question 11 of 30

    Which statement accurately describes the default behavior of Future.wait when one of its constituent futures encounters an error?

    Show the answer

    Answer: a · It fails with the error from the first future that failed, discarding all other results.

    Future.wait operates on an 'all or nothing' principle by default; if any of the provided futures fail, the entire Future.wait operation fails with that error, and any results from other successful futures are discarded. It does not return partial results or indicate failure with nulls.

    Read the full bite: Future.wait: Run Concurrent Dart Operations

  12. Question 12 of 30

    Which scenario best describes when a Dart Stream is the most appropriate choice?

    Show the answer

    Answer: b · When you want to process a series of data events as they become available over time.

    A Stream is specifically designed to handle a sequence of asynchronous events delivered over time, acting as a data pipeline. Option A describes the primary use case for a Future, which handles a single asynchronous result.

    Read the full bite: Dart's Stream: Asynchronous Data Pipelines

  13. Question 13 of 30

    When is it essential to use StreamController.broadcast() instead of the default StreamController() constructor?

    Show the answer

    Answer: a · When the stream is expected to have multiple independent listeners at the same time.

    The card explicitly states that the default StreamController() creates a single-subscription stream and will throw an error if multiple listeners try to subscribe. StreamController.broadcast() is specifically for scenarios requiring multiple listeners. Other options describe features not directly related to this distinction.

    Read the full bite: StreamController: The Faucet for Your Data Stream

  14. Question 14 of 30

    Which scenario best illustrates the primary use case for Dart's Completer?

    Show the answer

    Answer: b · Wrapping a native platform channel call that signals completion via a callback.

    The card explicitly states that Completer's primary use is "wrapping non-Future-based asynchronous APIs" such as native platform callbacks. Other options describe scenarios typically handled by standard async/await, Isolate.run, or Future chaining methods, which are simpler and preferred when a Completer is not strictly necessary.

    Read the full bite: Completer: Manually Control a Future's Lifecycle

  15. Question 15 of 30

    According to Flutter's design, what issue would arise if the build() method were placed directly on the StatefulWidget instead of its State object, particularly concerning event handlers?

    Show the answer

    Answer: b · Event handlers would capture the initial StatefulWidget instance, causing them to use outdated properties after a rebuild.

    The core reason build() is on State is to ensure that closures (like event handlers) capture the persistent State object. This State object's 'widget' property is updated to point to the latest StatefulWidget instance, guaranteeing that any 'widget.propertyName' accessed within the closure always reflects the current data. If build() were on the StatefulWidget, closures would capture the specific (and potentially old) StatefulWidget instance, leading to stale data. Option A is incorrect because StatefulWidgets are designed to be immutable; mutable data is is stored in the associated State object regardless of where build() is defined.

    Read the full bite: Flutter's build(): Why It Lives on State, Not the Widget

  16. Question 16 of 30

    What is a key limitation regarding the scope of what a widget's BuildContext can locate in the widget tree?

    Show the answer

    Answer: a · It cannot be used to find widgets that are children or descendants of the current widget.

    The card explicitly states that "a widget's context can't find its own children, only its parents" and "it can only see its ancestors," defining its scope limitation. While a BuildContext can become invalid, that's a lifecycle concern, not a limitation on what it can locate within the tree.

    Read the full bite: BuildContext: Your Widget's Address in the Tree

  17. Question 17 of 30

    Which statement best describes the primary function of a State object associated with a StatefulWidget?

    Show the answer

    Answer: a · It holds mutable data that needs to persist across UI rebuilds.

    The State object's primary role is to hold mutable data that persists across the StatefulWidget's rebuilds, allowing for dynamic UI updates. Option C describes 'app state', which the card explicitly advises against managing with StatefulWidgets.

    Read the full bite: StatefulWidget and State: Two Parts of a Whole

  18. Question 18 of 30

    Which statement accurately describes the sequence of events when setState() is called?

    Show the answer

    Answer: a · The provided callback function executes synchronously, and the widget is marked for a rebuild in an upcoming frame.

    The card states that the provided function executes synchronously first, then the framework marks the widget as needing a rebuild. The UI update and build method call happen in an upcoming frame, not instantly.

    Read the full bite: Flutter's setState(): Triggering UI Updates

  19. Question 19 of 30

    In Flutter's Box Constraint system, what is the fundamental principle governing how a parent widget determines the size of its child?

    Show the answer

    Answer: b · The parent provides a set of size limits, and the child selects its own size within those boundaries.

    The core principle is that parents pass down constraints (size limits), and the child then chooses its own size within those bounds. Option C is incorrect because parents provide limits, not direct assignments. Option D is incorrect as the child's desired size must always adhere to the parent's constraints. Option A is incorrect because Flutter uses a single-pass layout system, not an iterative negotiation.

    Read the full bite: Flutter's Box Constraint System: Parents Rule

  20. Question 20 of 30

    According to the card, what is the primary performance concern when using `MediaQuery.of(context)`?

    Show the answer

    Answer: a · It causes the widget to rebuild whenever any property within the MediaQueryData object changes.

    The card explicitly states that `MediaQuery.of(context)` is inefficient because it subscribes your widget to changes in the entire `MediaQueryData` object, causing a rebuild on any property change. Option D is incorrect because `MediaQuery.of(context)` does react to runtime changes; the issue is that it reacts to *all* changes, even irrelevant ones.

    Read the full bite: MediaQuery: Reading Device Properties Efficiently

  21. Question 21 of 30

    What is the primary scenario where LayoutBuilder is the most suitable widget?

    Show the answer

    Answer: b · When a widget's internal structure must adapt to the specific space constraints provided by its direct parent.

    LayoutBuilder is designed for widgets that need to adapt their layout based on the space allocated by their parent, as stated in the card. It should not be used for global screen dimensions, which is a common misconception and handled by MediaQuery.

    Read the full bite: LayoutBuilder: Build Widgets Based on Parent Size

  22. Question 22 of 30

    When would you primarily choose Flutter's Wrap widget over a Row widget?

    Show the answer

    Answer: d · When children might exceed available horizontal space and need to flow to a new line.

    The Wrap widget's core purpose is to prevent pixel overflow errors by automatically flowing children onto a new line when they exceed the available space, a behavior a standard Row does not provide. For horizontal scrolling, a ListView is the appropriate choice, and Row/Column offer more specific alignment controls like spaceBetween.

    Read the full bite: Flutter's Wrap Widget: The Row That Won't Overflow

  23. Question 23 of 30

    When is a Flutter FittedBox most likely to result in a layout error?

    Show the answer

    Answer: b · When it is placed directly inside a Row without additional constraints.

    FittedBox requires defined bounds from its parent to scale correctly. A Row provides unconstrained width to its children, causing FittedBox to fail without an intermediate constraining widget like Expanded or SizedBox. The other scenarios are valid use cases or intended behaviors.

    Read the full bite: Flutter's FittedBox: Scale Any Widget to Fit

  24. Question 24 of 30

    Which scenario is explicitly identified as a situation where AspectRatio should be avoided due to potential layout failure or unpredictable behavior?

    Show the answer

    Answer: c · When its direct parent widget provides unconstrained dimensions for its children.

    The card explicitly states to "Avoid AspectRatio when the child is inside a parent with unconstrained dimensions" because it "cannot resolve the constraints" and the "layout will likely fail or behave unpredictably." In other scenarios, AspectRatio either adapts to constraints or successfully enforces the ratio.

    Read the full bite: AspectRatio: Forcing a Widget's Proportions

  25. Question 25 of 30

    When _formKey.currentState!.validate() is invoked on a Flutter Form, what is its immediate effect?

    Show the answer

    Answer: b · It executes the validator function for every descendant FormField.

    The card explicitly states that calling validate() "triggers the validator on every field." Option C describes the action of the save() method, not validate().

    Read the full bite: Flutter's Form Widget: Grouping and Validating Input

  26. Question 26 of 30

    For which scenario is direct management of a FocusNode most appropriate?

    Show the answer

    Answer: d · To programmatically shift keyboard focus from an email TextField to a password TextField after email submission.

    Direct management of a FocusNode is ideal for programmatic control, such as moving focus between fields in a form, as described in the canonical example. For simply checking if a widget has focus during a build, Focus.of(context).hasFocus is generally simpler, and automatic traversal is handled by Focus and FocusScope widgets without direct FocusNode management.

    Read the full bite: FocusNode: Programmatically Managing Widget Focus

  27. Question 27 of 30

    After a user swipes an item using Flutter's Dismissible widget, what is the most crucial step to prevent the item from reappearing on subsequent rebuilds?

    Show the answer

    Answer: c · Removing the corresponding data model from the list that builds the Dismissible widgets.

    The Dismissible widget only handles the UI animation; the most common mistake is not removing the item from the underlying data source. If the data isn't removed in the onDismissed callback, the item will reappear. While a unique Key is required, it doesn't handle data persistence, and calling setState alone without modifying the data won't prevent the item from reappearing.

    Read the full bite: Dismissible: The Swipe-to-Remove Widget in Flutter

  28. Question 28 of 30

    Which mental model best describes how GoRouter approaches navigation in a Flutter application?

    Show the answer

    Answer: c · A website where each distinct screen or view corresponds to a unique URL path.

    The card states, "Think of your app not as a stack of screens, but as a website with distinct pages, each with a unique URL." This URL-centric, declarative approach is GoRouter's core mental model. Option D describes Flutter's imperative Navigator 1.0, which GoRouter aims to supersede for complex navigation.

    Read the full bite: GoRouter: URL-Based Navigation for Flutter Apps

  29. Question 29 of 30

    For which scenario would Flutter's Router API typically be considered over-engineered?

    Show the answer

    Answer: a · Creating a simple mobile app with a linear user flow and no deep links.

    The card states that for "very simple applications with a linear flow and no need for web support or deep linking, the original Navigator API is simpler due to less boilerplate." The other options describe scenarios where the Router API's advanced control and features are explicitly beneficial and necessary.

    Read the full bite: Flutter's Router API: Declarative Navigation

  30. Question 30 of 30

    What is the primary benefit of using a Flutter Hero animation for screen transitions?

    Show the answer

    Answer: a · It provides a continuous visual narrative, guiding the user's focus between related elements.

    Hero animations are designed to create a continuous visual narrative and guide the user's eye, preventing disorientation during screen transitions. The card explicitly advises against using them for complex widgets or as a universal replacement for PageRouteBuilder.

    Read the full bite: Flutter Hero Animations: Guiding the User's Eye

Could you explain these out loud?

That is what an interview actually tests. Tezvyn gives you questions like these with what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon