DartInterview 2 min read

Dart backend interview questions: contracts, concurrency and deployment

Discuss production boundaries with evidence rather than framework buzzwords.

On this page

Use the task API as a concrete reference. A useful advanced answer identifies an invariant, a failure mode and the evidence needed to verify the proposed solution.

How would you replace the in-memory repository?

Introduce an asynchronous repository contract and a durable schema, then preserve HTTP behavior with contract tests. Explain connection pooling, migrations and transaction boundaries. Do not simply add a database call inside a synchronous map method and leave its future unawaited.

What is the difference between authentication and authorization?

Verify a trusted identity, then constrain each resource operation by the caller’s permission/ownership. A parsed JWT payload is not a verified token, and a client-provided owner ID is not proof of identity. Test a second valid user attempting another user’s task.

What would make a retry unsafe?

A request can complete on the server even when the client times out. Repeating a charge or create operation may duplicate an effect. Discuss idempotency keys, durable outcomes and a bounded retry policy instead of retrying every 500 blindly.

When would you use a long-lived isolate?

When recurring measured CPU work justifies startup/transfer complexity and a clear worker lifecycle. Describe message IDs, errors, cancellation and shutdown. Separate this from waiting for a database response, which is ordinary asynchronous I/O.

Can a static shared host run this backend?

Only if it actually supports the needed persistent Dart process/runtime; ordinary PHP-only file hosting does not. A reverse proxy or CDN does not itself execute the service. Explain the chosen artifact, listener, secrets, health checks, persistence and rollback.

How would you prove an upgrade is safe?

Record the SDK/language baseline, inspect migrations, run analysis and focused tests, build the target artifact and verify one real user journey. A passing formatter or a persuasive AI explanation is not enough.

Practice

Write a short design note extending the task API to multiple users and durable storage. Name two adversarial tests and a deployment limitation. State which evidence you have and which integration still needs a configured environment.

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.