Top 40 Dart Interview Questions 2026
Dart is the language behind Flutter, Google's cross-platform UI framework. Candidates report that null safety, async/await, Future vs Stream, and isolates are...

What changed in 2026 drives
Mass-recruiter offer letters are flatter for 2026 batch - the 4-5 LPA ASE band has barely budged in three years while inflation eats real wages. Premium tracks (Digital, Pro, Elite, Specialist) are still where the differential lives, and they are entirely test-driven. If you are aiming higher than the default offer, the coding round is not optional pageantry - it is the entire interview.
What I'd actually study for this
- 01Two solid coding-round answers (1 medium-hard DSA each, with edge-case discussion) > five half-baked ones
- 02One real project you can defend end-to-end - file paths, design decisions, and what you would change
- 03One DBMS schema you actually built (not a textbook ER diagram), with at least 3 join-heavy queries written from memory
- 04Three behavioural STAR stories: failure recovered, conflict handled, ownership taken
Where most candidates trip up
The single biggest mistake is treating company-specific guides as primary prep and DSA as secondary. It is the opposite. Mass recruiters use the test as a filter, but premium tracks at every IT services company use coding to allocate offer band. Spend 70% of prep time on DSA + system fundamentals, 20% on company-specific patterns, 10% on HR rehearsal. Reverse that ratio and you collect the default offer.
Editorial commentary by Aditya Sharma · written for PapersAdda · not generated, not aggregated.
Last Updated: June 2026 | Level: Freshers to 3 Years Experience | Read Time: ~18 min
Dart is the language behind Flutter, Google's cross-platform UI framework. Candidates report that null safety, async/await, Future vs Stream, and isolates are the primary Dart-specific topics in Flutter developer interviews.
Pair with Flutter Interview Questions 2026 and Kotlin Interview Questions 2026 for mobile development preparation. Confirm current interview requirements on the official careers portal of your target company.
Table of Contents
- Dart Basics (Q1-Q12)
- OOP and Mixins (Q13-Q22)
- Async, Futures, and Streams (Q23-Q32)
- Null Safety and Generics (Q33-Q40)
- Mock Interview: 5 Questions
- FAQ
Dart Basics
Q1. What is Dart and how does it relate to Flutter? Easy
- Native ARM/x64 machine code (mobile/desktop)
- JavaScript (web via dart2js)
- Kernel bytecode (development mode with hot reload)
Q2. What is the difference between var, final, const, and typed declarations? Easy
// var: inferred type, mutable
var name = 'Aditya'; // String
name = 'other'; // ok
// final: inferred type, assigned once (runtime constant)
final now = DateTime.now(); // computed at runtime, can't change
// now = DateTime.now(); // compile error
// const: compile-time constant
const pi = 3.14159;
const list = [1, 2, 3]; // deeply immutable
// Typed declaration
String greeting = 'Hello';
int count = 0;
Q3. What are Dart's built-in types? Easy
// Numbers
int age = 25;
double price = 9.99;
num flexible = 3; // can be int or double
// Strings
String name = 'Aditya';
String multi = '''
multiline
string
''';
String interpolated = 'Hello, $name! Age: ${age + 1}';
// Booleans
bool isActive = true;
// Lists (typed)
List<int> nums = [1, 2, 3];
var fruits = <String>['apple', 'banana'];
// Maps
Map<String, int> scores = {'math': 95, 'science': 88};
// Sets
Set<String> tags = {'dart', 'flutter', 'mobile'};
Q4. What are Dart functions? Easy
// Named function
int add(int a, int b) => a + b; // arrow shorthand
// Optional positional parameters
String greet(String name, [String title = 'Mr']) => 'Hello, $title $name';
// Named parameters (with {})
void configure({required String host, int port = 8080, bool ssl = false}) {
print('$host:$port ssl=$ssl');
}
configure(host: 'localhost', ssl: true);
// Function as variable
int Function(int, int) operation = add;
print(operation(3, 4)); // 7
// Anonymous function
var double = (int n) => n * 2;
[1, 2, 3].map(double).toList(); // [2, 4, 6]
Q5. What are Dart collections and their key operations? Easy
// List
var list = [1, 2, 3, 4, 5];
list.add(6);
list.addAll([7, 8]);
list.remove(3);
list.where((n) => n.isEven).toList(); // [2, 4, 6, 8]
list.map((n) => n * n).toList();
list.reduce((a, b) => a + b); // sum
list.fold(0, (acc, n) => acc + n); // same
list.any((n) => n > 4); // true
list.every((n) => n > 0); // true
list.sort((a, b) => b.compareTo(a)); // descending
// Map
var map = {'a': 1, 'b': 2};
map['c'] = 3;
map.containsKey('a'); // true
map.containsValue(99); // false
map.entries.map((e) => '${e.key}=${e.value}').join(', ');
// Spread operator
var combined = [...list, ...[9, 10]];
Q6. What are Dart control flow features? Easy
// if/else
if (score >= 90) {
grade = 'A';
} else if (score >= 80) {
grade = 'B';
}
// for loop
for (var i = 0; i < 5; i++) { print(i); }
// for-in loop
for (var item in list) { print(item); }
// while
while (queue.isNotEmpty) { process(queue.removeFirst()); }
// switch (supports strings, enums)
switch (status) {
case 'active':
activate();
break;
case 'inactive':
deactivate();
break;
default:
print('unknown');
}
Q7. What is the ?? and ??= operator? Easy
// ?? : null coalescing - use right side if left is null
String? name;
String display = name ?? 'Anonymous'; // 'Anonymous'
// ??= : assign if null
name ??= 'Default'; // assigns only if name is null
// Cascade ..
// Chain multiple method calls on same object
var buffer = StringBuffer()
..write('Hello')
..write(', ')
..write('World');
print(buffer.toString()); // Hello, World
Q8. What are late variables? Medium
// late: declare non-nullable, initialize later
late String _cache;
late final Database _db;
void init() {
_cache = loadFromDisk(); // initialized before use
_db = Database.connect();
}
// late with initializer: lazy evaluation
late String heavyValue = computeExpensive();
// heavyValue computed only on first access
Using late without initializing before access throws LateInitializationError.
Q9. What are extension methods in Dart? Medium
extension StringExtensions on String {
bool get isEmail => contains('@') && contains('.');
String capitalize() => '${this[0].toUpperCase()}${substring(1)}';
int get wordCount => trim().split(RegExp(r'\s+')).length;
}
'hello world'.capitalize(); // 'Hello world'
'hello world'.wordCount; // 2
'[email protected]'.isEmail; // true
Q10. What are Dart enums? Medium
// Simple enum
enum Direction { north, south, east, west }
Direction.values // [north, south, east, west]
// Enhanced enum (Dart 2.17+)
enum Status {
active(label: 'Active'),
inactive(label: 'Inactive');
final String label;
const Status({required this.label});
bool get isActive => this == Status.active;
}
Status.active.label // 'Active'
Status.active.isActive // true
Q11. What are Dart's string features? Easy
var s = 'Hello, Dart!';
s.length // 12
s.toUpperCase() // 'HELLO, DART!'
s.contains('Dart') // true
s.startsWith('Hello') // true
s.substring(7, 11) // 'Dart'
s.split(', ') // ['Hello', 'Dart!']
s.replaceAll('l', 'L') // 'HeLLo, Dart!'
s.trim() // trims whitespace
s.padLeft(15, '0') // '000Hello, Dart!'
// String interpolation
var name = 'World';
'Hello, $name!' // Hello, World!
'2 + 2 = ${2 + 2}' // 2 + 2 = 4
Q12. Predict the output: Easy
void main() {
var nums = [1, 2, 3, 4, 5];
var result = nums
.where((n) => n.isOdd)
.map((n) => n * n)
.toList();
print(result);
print(result.reduce((a, b) => a + b));
}
Output:
[1, 9, 25]
35
Explanation: Odd numbers: [1,3,5]. Squared: [1,9,25]. Sum: 35.
OOP and Mixins
Q13. What are Dart classes? Medium
class Person {
final String name;
int age;
// Constructor
Person(this.name, this.age);
// Named constructor
Person.anonymous() : name = 'Anonymous', age = 0;
// Factory constructor
factory Person.fromJson(Map<String, dynamic> json) {
return Person(json['name'] as String, json['age'] as int);
}
// Getter
String get info => '$name ($age)';
// Method
void birthday() => age++;
@override
String toString() => 'Person($name, $age)';
}
Q14. What is extends, implements, and with? Medium
| Keyword | Purpose | Multiple | Inherits implementation |
|---|---|---|---|
extends | Inherit from class | Single only | Yes |
implements | Satisfy contract | Multiple | No (must implement all) |
with | Mixin composition | Multiple | Yes (mixin code) |
abstract class Animal {
String get sound;
void makeSound() => print(sound);
}
mixin Swimmer { void swim() => print('swimming'); }
mixin Flyer { void fly() => print('flying'); }
class Duck extends Animal with Swimmer, Flyer implements JsonSerializable {
@override String get sound => 'Quack';
@override Map<String, dynamic> toJson() => {'type': 'duck'};
}
Q15. What are mixins in Dart? Advanced
mixin Logger {
void log(String message) => print('[${DateTime.now()}] $message');
void logError(String error) => print('[ERROR] $error');
}
mixin Validator {
bool validate(String value) => value.isNotEmpty && value.length > 3;
}
class UserService with Logger, Validator {
void createUser(String name) {
if (!validate(name)) {
logError('Invalid name: $name');
return;
}
log('Creating user: $name');
}
}
Mixins with on constraint:
mixin AnimationMixin on State<StatefulWidget> {
// Can only be mixed into State subclasses
void animate() { setState(() {}); }
}
Q16. What is operator overloading in Dart? Medium
class Vector {
final double x, y;
const Vector(this.x, this.y);
Vector operator +(Vector other) => Vector(x + other.x, y + other.y);
Vector operator *(double scalar) => Vector(x * scalar, y * scalar);
bool operator ==(Object other) =>
other is Vector && other.x == x && other.y == y;
@override
int get hashCode => Object.hash(x, y);
@override
String toString() => 'Vector($x, $y)';
}
var v1 = Vector(1, 2);
var v2 = Vector(3, 4);
print(v1 + v2); // Vector(4.0, 6.0)
print(v1 * 2.0); // Vector(2.0, 4.0)
Q17. What are abstract classes and interfaces? Medium
// Abstract class: cannot be instantiated, can have concrete methods
abstract class Repository<T> {
Future<T?> findById(String id); // abstract
Future<List<T>> findAll(); // abstract
// Concrete: default behavior
Future<bool> exists(String id) async => (await findById(id)) != null;
}
// Dart has no interface keyword: any class can be used as an interface
class UserRepository extends Repository<User> {
@override
Future<User?> findById(String id) async { /* ... */ }
@override
Future<List<User>> findAll() async { /* ... */ }
}
Q18. What are Dart generics? Medium
// Generic class
class Box<T> {
T value;
Box(this.value);
T getValue() => value;
Box<R> map<R>(R Function(T) transform) => Box(transform(value));
}
// Bounded generics
class SortedList<T extends Comparable<T>> {
final List<T> _data = [];
void add(T item) {
_data.add(item);
_data.sort();
}
}
// Generic function
T identity<T>(T value) => value;
List<T> repeat<T>(T value, int count) => List.filled(count, value);
Q19. What is const in the context of constructors? Medium
// const constructor: creates compile-time constant
class Point {
final int x, y;
const Point(this.x, this.y);
}
const p1 = Point(1, 2);
const p2 = Point(1, 2);
identical(p1, p2); // true - same instance (interned)
// vs non-const
final p3 = Point(1, 2);
final p4 = Point(1, 2);
identical(p3, p4); // false - different instances
In Flutter, const widgets are cached and never rebuilt.
Q20. What is @override and @required? Easy
class Animal {
String get sound => '';
void makeSound() => print(sound);
}
class Dog extends Animal {
@override // tells analyzer this overrides a superclass member
String get sound => 'Woof';
}
// @required was pre-null-safety; now use 'required' keyword
void createUser({required String name, required int age}) { }
Q21. Predict the output: Medium
class A {
String name() => 'A';
}
class B extends A {
@override
String name() => 'B';
}
class C extends B {
@override
String name() => super.name() + 'C';
}
void main() {
A obj = C();
print(obj.name());
}
Output: BC
Explanation: obj is declared as type A but actually holds a C instance. Dart uses runtime polymorphism. C.name() returns super.name() (which is B.name() = "B") + "C" = "BC".
Q22. What are Records in Dart (3.0+)? Medium
// Records: anonymous immutable data structures
(String, int) record = ('Aditya', 25);
print(record.$1); // 'Aditya'
print(record.$2); // 25
// Named fields
({String name, int age}) namedRecord = (name: 'Aditya', age: 25);
print(namedRecord.name); // 'Aditya'
// Pattern matching with records
var (name, age) = ('Priya', 23);
// Functions returning multiple values
(String, int) getUser() => ('Aditya', 25);
var (n, a) = getUser();
Async, Futures, and Streams
Q23. What is a Future in Dart? Medium
Future<String> fetchUserName(int id) async {
await Future.delayed(Duration(seconds: 1)); // simulate network
return 'Aditya';
}
void main() async {
// Await: suspend until future completes
String name = await fetchUserName(1);
print(name);
// then/catchError (callback style)
fetchUserName(1)
.then((name) => print(name))
.catchError((e) => print('Error: $e'));
}
Q24. What is async* and yield? Advanced
// async generator: returns Stream
Stream<int> countDown(int from) async* {
for (int i = from; i >= 0; i--) {
yield i; // emit one value
await Future.delayed(Duration(seconds: 1));
}
}
// Use with await for
main() async {
await for (int n in countDown(5)) {
print(n); // 5, 4, 3, 2, 1, 0 (one per second)
}
}
Q25. What is the difference between Future and Stream? Medium
| Feature | Future | Stream |
|---|---|---|
| Values | One value | Zero or more values |
| Completion | Once | Ongoing (until done) |
| Error | Once | Can recover |
| Analogy | Single HTTP response | WebSocket / file read |
| Listen | await / then | await for / listen |
// Future: one-shot
Future<int> getFutureValue() async => 42;
// Stream: multiple values
Stream<int> getStream() async* {
for (int i = 1; i <= 5; i++) { yield i; }
}
Q26. What are StreamController and StreamSubscription? Advanced
// StreamController: create a custom stream
final controller = StreamController<int>();
// Add values
controller.sink.add(1);
controller.sink.add(2);
controller.sink.close();
// Listen
final sub = controller.stream.listen(
(value) => print('Got: $value'),
onError: (e) => print('Error: $e'),
onDone: () => print('Stream done'),
);
// Broadcast stream: multiple listeners allowed
final broadcastController = StreamController<String>.broadcast();
Q27. What are Future combinators? Advanced
// Wait for multiple futures concurrently
final results = await Future.wait([
fetchUser(1),
fetchUser(2),
fetchUser(3),
]); // completes when ALL done
// Race: first completed wins
final first = await Future.any([
fetchFromPrimary(),
fetchFromBackup(),
]);
// Error handling
try {
final data = await Future.wait([riskyCall1(), riskyCall2()]);
} catch (e) {
print('One or more failed: $e');
}
Q28. What are isolates in Dart? Advanced
import 'dart:isolate';
void heavyComputation(SendPort sendPort) {
// This runs in a separate isolate
int result = 0;
for (int i = 0; i < 1000000; i++) result += i;
sendPort.send(result);
}
void main() async {
final receivePort = ReceivePort();
await Isolate.spawn(heavyComputation, receivePort.sendPort);
final result = await receivePort.first;
print('Result: $result');
}
// Simpler with compute() in Flutter
final result = await compute(heavyComputation, inputData);
Q29. What is Zone in Dart? Advanced
import 'dart:async';
runZonedGuarded(
() async {
// All async errors in this zone are caught
await riskyOperation();
},
(error, stackTrace) {
print('Caught: $error');
reportToSentry(error, stackTrace);
},
);
Q30. Predict the output: Medium
void main() async {
print('start');
Future.delayed(Duration.zero, () => print('delayed'));
await Future.value(null);
print('after await');
print('end');
}
Output:
start
after await
end
delayed
Explanation: Future.delayed(Duration.zero) schedules a microtask, but await Future.value() yields first, runs synchronous code after await, then the event loop processes the delayed callback.
Q31. What is compute in Flutter? Medium
// compute: run a function in a separate isolate
// Useful for CPU-intensive work that would block the UI thread
Future<List<Photo>> fetchPhotos(http.Client client) async {
final response = await client.get(Uri.parse('https://api.example.com/photos'));
// Parse JSON in a separate isolate to avoid UI jank
return compute(parsePhotos, response.body);
}
List<Photo> parsePhotos(String responseBody) {
final parsed = jsonDecode(responseBody).cast<Map<String, dynamic>>();
return parsed.map<Photo>((json) => Photo.fromJson(json)).toList();
}
Q32. What is the event loop in Dart? Advanced
- Microtask queue: runs before event queue (Future.microtask, scheduleMicrotask)
- Event queue: regular async events (timers, I/O, user input)
void main() {
print('1'); // sync
Future(() => print('4')); // event queue
Future.microtask(() => print('2')); // microtask queue
print('3'); // sync
}
// Output: 1 3 2 4
// Sync first, then microtasks, then events
Null Safety and Generics
Q33. How does Dart null safety work? Medium
// Non-nullable by default
String name = 'Aditya';
// name = null; // compile error
// Nullable: add ?
String? maybeNull = null;
maybeNull = 'now set';
// Null-aware operators
maybeNull?.length // null if maybeNull is null
maybeNull ?? 'default' // 'default' if null
maybeNull ??= 'assigned'; // assign if null
// Non-null assertion (throws if null)
String! = maybeNull! // crashes if null, avoid
Q34. What is is and as in Dart? Medium
Object obj = 'hello';
// Type check
if (obj is String) {
print(obj.length); // smart cast inside if block
}
// Negative
if (obj is! int) { print('not an int'); }
// Type cast (throws TypeError if wrong)
String s = obj as String; // ok
// int n = obj as int; // TypeError!
// Safe cast: use is first
if (obj is String) {
String s = obj; // automatic promotion
}
Q35. What are sound null safety guarantees? Advanced
// The type system knows this can't be null
String value = 'hello';
int length = value.length; // never throws NullPointerException
// The only way to get a null dereference in sound null safe Dart:
String? nullable = null;
nullable!.length // deliberately bypassing safety with !
Q36. What are type parameters and bounds? Advanced
// Bounded generics
class SortedCollection<T extends Comparable<T>> {
final List<T> _items = [];
void add(T item) { _items.add(item); _items.sort(); }
T get first => _items.first;
}
// Multiple bounds via interface
abstract class Printable { void print(); }
abstract class Saveable { Future<void> save(); }
class Widget<T extends Printable> { /* ... */ }
// Covariance in return types
class Animal { Animal copy() => Animal(); }
class Dog extends Animal {
@override
Dog copy() => Dog(); // covariant return type
}
Q37. What is typedef in Dart? Medium
// typedef: name a function type
typedef IntTransform = int Function(int);
typedef Callback = void Function(String message, int code);
typedef AsyncCallback<T> = Future<T> Function();
// Use in signatures
void applyTwice(IntTransform fn, int value) {
print(fn(fn(value)));
}
IntTransform double = (n) => n * 2;
applyTwice(double, 3); // 12
// Also for non-function types (Dart 2.13+)
typedef StringMap = Map<String, String>;
Q38. What is pattern matching in Dart 3.0? Advanced
// Switch expressions (Dart 3.0)
String describe(Object value) => switch (value) {
int n when n < 0 => 'negative',
int n when n == 0 => 'zero',
int n => 'positive int: $n',
String s => 'string: $s',
_ => 'other',
};
// Destructuring patterns
var (x, y) = (1, 2);
var [first, second, ...rest] = [1, 2, 3, 4, 5];
var {'name': name, 'age': age} = {'name': 'Aditya', 'age': 25};
Q39. What are sealed classes in Dart 3.0? Advanced
sealed class Shape {}
class Circle extends Shape { final double radius; Circle(this.radius); }
class Rectangle extends Shape { final double w, h; Rectangle(this.w, this.h); }
class Triangle extends Shape { final double b, h; Triangle(this.b, this.h); }
double area(Shape shape) => switch (shape) {
Circle(radius: var r) => 3.14159 * r * r,
Rectangle(w: var w, h: var h) => w * h,
Triangle(b: var b, h: var h) => 0.5 * b * h,
};
// Exhaustive - no default needed, compiler ensures all cases covered
Q40. Predict the output: Advanced
void main() {
final list = <int?>[1, null, 3, null, 5];
final nonNull = list.whereType<int>().toList();
print(nonNull);
print(nonNull.fold(0, (acc, n) => acc + n));
}
Output:
[1, 3, 5]
9
Explanation: whereType<int>() filters elements that are exactly int (non-null), removing the nulls. fold sums: 1+3+5=9.
Mock Interview: 5 Questions
- Implement a generic
Pair<A, B>class in Dart withswap,mapFirst, andmapSecondmethods. - Explain the difference between
Future.waitandFuture.anywith a use-case for each. - Write a Stream that emits a heartbeat every second and can be cancelled.
- Why are isolates used instead of threads in Dart? What are the tradeoffs?
- Convert this callback-based code to use async/await:
fetchUser(id, onSuccess: (u) => ..., onError: (e) => ...).
FAQ
Q: Do I need to know Dart well if I am applying for Flutter jobs? A: Yes. Flutter interviews test both Flutter framework knowledge and Dart language proficiency. Null safety, async/await, and the OOP system are core Dart topics that come up in every Flutter interview.
Q: Is Flutter replacing React Native? A: Both have active ecosystems. Flutter uses Dart (less popular than JavaScript), but its rendering engine is independent of platform-native components, giving more consistent UI. React Native uses JavaScript and bridges to native components. For India's job market, React Native has more openings currently, but Flutter adoption is growing rapidly.
Q: What is the difference between StatefulWidget and StatelessWidget?
A: This is a Flutter question (not pure Dart). StatelessWidget renders based on its configuration alone. StatefulWidget has mutable state managed by a State object, and can call setState() to trigger a rebuild. This is covered in depth in the Flutter Interview Questions 2026 guide.
Related reading: Flutter Interview Questions 2026 | Kotlin Interview Questions 2026 | Swift Interview Questions 2026 | React Native Interview Questions 2026
Methodology applied to this articlelast verified 8 Jun 2026
- No fabricated salary numbers or success rates. If we quote a range, it's sourced.
- No noun-substituted templates. This article was not generated by swapping company names in a stock prompt.
- No paid placements, sponsored coaching links, or affiliate-shilled course pushes.
topic cluster
More resources in Interview Questions
Use the category hub to browse similar questions, exam patterns, salary guides, and preparation resources related to this topic.
paid contributor programme
Sat this this year? Share your story, earn ₹500.
First-person experience reports help future candidates prep smarter. We pay verified contributors ₹500 via UPI per accepted story with byline.
Submit your story →ready to practice?
Take a free timed mock test
Put what you learned into practice. Our mock tests match the 2026 pattern with timer, navigator, reveal, and score breakdown. No signup.