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)
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:
- Hot reload: Dart’s architecture enables sub-second UI updates during development
- AOT and JIT compilation: Fast development (JIT) and fast production (AOT)
- No bridge: Unlike React Native, Flutter/Dart doesn’t cross a JavaScript bridge
- 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:
| |
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 = 10instead ofint 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
| |
Sealed Classes and Pattern Matching
| |
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:
| Mode | Use Case | Output |
|---|---|---|
| JIT (Just-in-Time) | Development | Fast hot reload, slower startup |
| AOT (Ahead-of-Time) | Production mobile | Small binaries, fast startup |
| JavaScript | Web | Runs in any browser |
| WebAssembly | Web (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:
| |
Sound null safety means the compiler can guarantee null-related errors won’t occur at runtime.
Dart vs. Other Languages
| Feature | Dart | TypeScript | Kotlin | Swift |
|---|---|---|---|---|
| Type system | Sound, null-safe | Structural, optional | Sound, null-safe | Sound, null-safe |
| Compilation | JIT, AOT, JS, WASM | Transpile to JS | JVM, Native, JS | Native, WASM |
| Main use case | Flutter | Web/Node.js | Android/JVM | Apple platforms |
| Hot reload | Yes (Flutter) | Yes (with tools) | Limited | Yes (SwiftUI) |
The Dart Ecosystem
Package Management
Dart uses pub.dev for packages, with a declarative pubspec.yaml:
| |
Testing
Dart has excellent built-in testing support:
| |
Tooling
- dart analyze: Static analysis
- dart format: Code formatting
- dart doc: API documentation generation
- dart compile: AOT compilation to native executables
Why Learn Dart?
- Flutter development: The primary way to build Flutter apps
- Modern language design: Clean syntax, null safety, pattern matching
- Excellent tooling: Great IDE support, fast compile times
- Growing job market: Flutter/Dart demand continues increasing
- 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
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
Influenced
Running Today
Run examples using the official Docker image:
docker pull dart:stableExample usage:
docker run --rm -v $(pwd):/app -w /app dart:stable dart run hello.dart