Est. 2011 Beginner

Dart

A client-optimized language for fast apps on any platform, developed by Google and the foundation for Flutter.

Created by Lars Bak and Kasper Lund (Google)

Paradigm Multi-paradigm: Object-Oriented, Functional, Imperative, Reflective
Typing Static, Strong, Sound null safety
First Appeared 2011
Latest Version Dart 3.10 (2025)

Dart is a client-optimized programming language developed by Google for building fast apps on any platform. Originally designed as a potential replacement for JavaScript, Dart found its true calling as the language behind Flutter, Google’s revolutionary cross-platform UI framework.

History & Origins

Dart was created by Lars Bak and Kasper Lund, two Danish software engineers at Google. Bak was famous for his work on V8, Google Chrome’s JavaScript engine, while Lund had extensive experience in virtual machines and language design from their work together at OOVM and Sun Microsystems.

The JavaScript Problem

By 2010, Google faced a challenge: JavaScript, despite V8’s optimizations, had fundamental design issues that couldn’t be fixed without breaking the web. Google engineers wanted:

  • Better performance: Predictable, optimizable code
  • Improved tooling: Static analysis, refactoring support
  • Scalability: Better structure for large applications
  • Optional types: Gradual typing for flexibility

Google initially hoped to embed a Dart VM in Chrome, allowing developers to choose between JavaScript and Dart. This plan was abandoned in 2015 when it became clear other browser vendors wouldn’t adopt Dart. Instead, Dart pivoted to compile-to-JavaScript, similar to TypeScript.

The Flutter Revolution

Dart’s fortunes changed dramatically with Flutter. Announced in 2015 and reaching 1.0 in 2018, Flutter chose Dart for several key reasons:

  1. Hot reload: Dart’s architecture enables sub-second UI updates during development
  2. AOT and JIT compilation: Fast development (JIT) and fast production (AOT)
  3. No bridge: Unlike React Native, Flutter/Dart doesn’t cross a JavaScript bridge
  4. Customizable: Google controls the language and can optimize for Flutter’s needs

Flutter’s success drove massive Dart adoption. By 2024, Flutter is one of the most popular cross-platform frameworks, and Dart benefits from the thousands of developers using it.

Language Design

Dart is designed to feel familiar to developers from C-style languages:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
class Person {
  final String name;
  final int age;

  Person(this.name, this.age);

  String greet() => 'Hello, I am $name!';
}

void main() {
  var person = Person('Alice', 30);
  print(person.greet());
}

Key language features:

  • Sound null safety: Variables can’t be null unless explicitly declared nullable
  • Strong typing: Static type checking catches errors at compile time
  • Type inference: Write var x = 10 instead of int x = 10
  • First-class functions: Functions are objects, enabling functional patterns
  • Async/await: Built-in support for asynchronous programming
  • Isolates: Concurrency without shared memory

Dart 3: A Modern Reimagining

Dart 3.0 (2023) was a significant release that modernized the language:

Records and Patterns

1
2
3
4
5
6
7
// Records - lightweight data structures
(String, int) getUser() => ('Alice', 30);

void main() {
  var (name, age) = getUser();  // Destructuring
  print('$name is $age');
}

Sealed Classes and Pattern Matching

1
2
3
4
5
6
7
8
sealed class Shape {}
class Circle extends Shape { final double radius; Circle(this.radius); }
class Rectangle extends Shape { final double width, height; Rectangle(this.width, this.height); }

double area(Shape shape) => switch (shape) {
  Circle(radius: var r) => 3.14159 * r * r,
  Rectangle(width: var w, height: var h) => w * h,
};

Class Modifiers

Dart 3 added final, base, interface, and sealed class modifiers for precise API control.

Dart’s Compilation Model

Dart is unique in supporting multiple compilation modes:

ModeUse CaseOutput
JIT (Just-in-Time)DevelopmentFast hot reload, slower startup
AOT (Ahead-of-Time)Production mobileSmall binaries, fast startup
JavaScriptWebRuns in any browser
WebAssemblyWeb (Dart 3.4+)Near-native performance

This flexibility is key to Flutter’s development experience: JIT for instant hot reload during development, AOT for production performance.

Null Safety

Dart 2.12 (2021) introduced sound null safety, one of its most important features:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
String? nullableString;  // Can be null
String nonNullableString = 'Hello';  // Cannot be null

// Compiler error if you try to use nullableString without checking
if (nullableString != null) {
  print(nullableString.length);  // Safe - compiler knows it's not null
}

// Null-aware operators
print(nullableString?.length ?? 0);  // Safe access with default

Sound null safety means the compiler can guarantee null-related errors won’t occur at runtime.

Dart vs. Other Languages

FeatureDartTypeScriptKotlinSwift
Type systemSound, null-safeStructural, optionalSound, null-safeSound, null-safe
CompilationJIT, AOT, JS, WASMTranspile to JSJVM, Native, JSNative, WASM
Main use caseFlutterWeb/Node.jsAndroid/JVMApple platforms
Hot reloadYes (Flutter)Yes (with tools)LimitedYes (SwiftUI)

The Dart Ecosystem

Package Management

Dart uses pub.dev for packages, with a declarative pubspec.yaml:

1
2
3
4
5
6
name: my_app
dependencies:
  http: ^1.1.0
  json_annotation: ^4.8.0
dev_dependencies:
  test: ^1.24.0

Testing

Dart has excellent built-in testing support:

1
2
3
4
5
6
7
import 'package:test/test.dart';

void main() {
  test('String concatenation', () {
    expect('Hello' + ' ' + 'World', equals('Hello World'));
  });
}

Tooling

  • dart analyze: Static analysis
  • dart format: Code formatting
  • dart doc: API documentation generation
  • dart compile: AOT compilation to native executables

Why Learn Dart?

  1. Flutter development: The primary way to build Flutter apps
  2. Modern language design: Clean syntax, null safety, pattern matching
  3. Excellent tooling: Great IDE support, fast compile times
  4. Growing job market: Flutter/Dart demand continues increasing
  5. Full-stack potential: Server-side Dart with shelf, aqueduct, or serverpod

Dart has evolved from “Google’s JavaScript replacement” to a mature, well-designed language powering millions of Flutter applications. Its combination of productivity features (hot reload, null safety) and performance (AOT compilation) makes it uniquely suited for modern app development.

Timeline

2011
Dart unveiled at GOTO conference in Aarhus, Denmark
2013
Dart 1.0 released with stable SDK and core libraries
2015
Dart 1.12 introduces null-aware operators (?., ??)
2017
Flutter alpha released, dramatically increasing Dart adoption
2018
Dart 2.0 released with strong mode and sound type system
2021
Dart 2.12 introduces sound null safety
2023
Dart 3.0 released with records, patterns, and class modifiers
2024
Dart 3.4 adds WebAssembly compilation support
2025
Dart 3.10 introduces dot shorthands and enhanced formatter

Notable Uses & Legacy

Flutter

Google's UI toolkit for building natively compiled mobile, web, and desktop apps from a single codebase.

Google Ads

Google's advertising platform frontend is built with Dart and Flutter.

Google Pay

The Google Pay app uses Flutter/Dart for cross-platform mobile development.

Alibaba

Uses Flutter/Dart for their Xianyu (second-hand marketplace) app serving millions of users.

BMW

My BMW app built with Flutter/Dart for connected car services.

eBay Motors

eBay's automotive marketplace app built with Flutter and Dart.

Language Influence

Influenced By

Java JavaScript C# Erlang Smalltalk Strongtalk

Influenced

Flutter TypeScript (competition) Swift (some features)

Running Today

Run examples using the official Docker image:

docker pull dart:stable

Example usage:

docker run --rm -v $(pwd):/app -w /app dart:stable dart run hello.dart

Topics Covered

Last updated: