Flutter ● ● ○

Kodebits Day 46: Extension Method

Jun 24 2026
Practice extension methods with a short dart challenge.

What is the output?

extension on int {
  int get doubled => this * 2;
}
void main() {
  print(5.doubled);
}


Try it in the online Dart Playground →

[spoiler title="Solution"]

Answer:

10

Explanation:

Extension methods add functionality to existing types without modification.

[/spoiler]


Further Reading