Interview Q&A · 8 questions · 4 answered publicly

Dart Fundamentals Interview Questions

Ordered by how often they're asked. Sign in free to see every answer, rate your confidence and run timed mock interviews.

  1. Most asked What is sound null safety in Dart?

    Summary

    Types are non-nullable by default; T? allows null. The compiler forces null checks before using nullable values and guarantees non-nullable variables never hold null at runtime.

    Longer Answer

    Use ?., ?? and ??=, rely on type promotion after checks, and keep the ! operator and late for rare cases.

    Key Points

    • Non-nullable by default.
    • Flow analysis promotes after checks.
    • ! and late can still fail at runtime.

    Deep dive: Dart Fundamentals: Null Safety

    Permalink

  2. Most asked Explain Future, async/await and Stream in Dart.

    Summary

    A Future is a single value available later; async/await writes asynchronous code sequentially without blocking the event loop; a Stream delivers multiple values over time, consumed with await for or listen.

    Longer Answer

    Run independent futures concurrently with Future.wait or a record's .wait; add timeouts; use isolates for CPU-heavy work.

    Key Points

    • Single event loop per isolate.
    • Futures for one result, Streams for many.
    • Concurrency via Future.wait; parallelism via isolates.

    Deep dive: Dart Fundamentals: Async Dart

    Permalink

  3. Most asked What's the difference between final and const?

    Summary

    Both are single-assignment. final values may be computed at runtime; const values are compile-time constants and const collections/objects are deeply immutable and canonicalised.

    Longer Answer

    In Flutter, const widgets can be reused without rebuilding, which helps performance.

    Key Points

    • final: runtime, once.
    • const: compile time, deeply immutable.
    • const objects are canonicalised.

    Deep dive: Dart Fundamentals: Variables

    Permalink

  4. Most asked What do records, patterns and sealed classes add in Dart 3?

    Summary

    Records group values without a class and compare by value; patterns destructure data in variable declarations, switch and if-case; sealed classes define a closed set of subtypes so switches over them are checked for exhaustiveness.

    Longer Answer

    Sealed classes are ideal for UI/state modelling (loading, success, failure).

    Key Points

    • Records for lightweight tuples.
    • Destructuring and switch expressions.
    • Exhaustive switches with sealed classes.

    Deep dive: Dart Fundamentals: Records and Patterns

    Permalink

  5. What are isolates?
  6. What are mixins and extension methods in Dart?
  7. What is a factory constructor?
  8. How should Dart code handle errors?

Was this page helpful?