DartInterview 2 min read

Dart intermediate interview questions: async, generics and patterns

Reason about asynchronous ordering, generic contracts and modern structured data.

On this page

Intermediate interviews often test whether you can connect a language rule to application behavior. Use actual scenarios: a slow request, a parsed response and a cache keyed by a model ID.

Does async run work on another thread?

No. An isolate’s async continuation can yield while waiting, but synchronous CPU work still occupies that isolate. Describe when a Future is sufficient and when measured CPU work may justify an isolate. Do not claim that every Future creates a thread.

What does Future.wait guarantee?

It waits for the supplied operations according to its contract and preserves input order in the result list. Starting operations together differs from awaiting one before starting the next. A timeout is not automatically cancellation. Explain how a dashboard should handle one failed request.

Why use a generic Page<T>?

It preserves the relationship between the container and its item type while reusing pagination structure. Replacing T with dynamic loses useful checks at consumer call sites. Discuss a mutation boundary and why an unmodifiable list is only shallow protection.

When is a record better than a class?

A small local aggregate without identity or behavior can be clearer as a record. A public invariant-rich domain model may need a class. Records have typed fixed shapes; an untyped map does not provide the same access contract.

How do patterns help with JSON?

They check a data shape and bind typed locals. Domain constraints and authorization remain separate. Demonstrate rejection of a string ID where the API requires an integer rather than applying an unchecked cast deep inside the UI.

Why can a Set lose a mutable key?

If fields affecting equality/hash change after insertion, later lookups can use a different hash. Keep hash-relevant identity immutable and define equality consistently. Explain identity versus value equality before recommending a code generator.

Practice

Build three tiny examples: a controlled future failure, a validated record and a custom ID set. Predict output, run it and explain one alternative design. Use the intermediate path to revisit the concepts you cannot yet demonstrate.

How this topic connects

Apply it next

Lesson progressMark complete after checking the example and exercise.

Find your next idea

Search lessons, code examples and projects.

Type a few words to start exploring.