Dart is a general-purpose, statically typed programming language created at Google and optimized for building client applications, most prominently user interfaces with the Flutter framework. Among programming languages, it stands out for one toolchain that offers fast development cycles with hot reload and ahead-of-time compilation to native machine code for release builds.
Dart uses a familiar C-style syntax, class-based object orientation and sound null safety, so developers who know Java, C#, Kotlin or TypeScript usually read it within days. The language is published as the ECMA-408 standard, although its practical evolution is driven by the open-source Dart SDK.
How Dart compiles and runs code
Dart code runs through several compilation strategies chosen by the target platform and the stage of development. During development, the Dart VM uses just-in-time (JIT) compilation, which enables stateful hot reload: changed source code is injected into a running application in roughly a second without losing the current screen state.
For production, the toolchain performs ahead-of-time (AOT) compilation to ARM or x64 machine code. AOT output starts quickly, has predictable performance and needs no interpreter on the device, which is why mobile app stores accept Flutter applications without restriction. For the web, Dart compiles to optimized JavaScript or to WebAssembly using the WasmGC proposal.
The following table summarizes the main compilation targets and their typical use.
| Target | Tool or mode | Typical use | Key property |
|---|---|---|---|
| JIT on the Dart VM | dart run | Development, scripting | Hot reload, rich debugging |
| AOT native code | dart compile exe | Mobile, desktop, servers | Fast startup, no runtime compiler |
| JavaScript | dart compile js | Web browsers | Tree shaking, minification |
| WebAssembly | dart compile wasm | Modern browsers | Requires WasmGC support |
| Kernel snapshot | dart compile kernel | Tool distribution | Platform-neutral intermediate form |
Type system and core language features
Dart has a sound static type system, meaning that a variable declared as int can never hold a string at run time. Since Dart 3, null safety is mandatory: a type such as String excludes null, while String? explicitly allows it. The compiler uses this guarantee for flow analysis and for removing unnecessary null checks in compiled code.
Type inference keeps code concise, since var and final infer the type from the initializer. Generics are reified, so type arguments remain available at run time, unlike the erased generics of Java. Dart 3 also added records, pattern matching and sealed classes, which support exhaustive switch expressions over closed type hierarchies.
The table below lists the features that most shape everyday Dart code.
| Feature | What it provides | Example syntax |
|---|---|---|
| Sound null safety | Compile-time protection from null errors | String? name; |
| Mixins | Reuse of behavior across class hierarchies | class A with Logger |
| Extension methods | New methods on existing types | extension on String |
| Records | Lightweight anonymous tuples | (int, String) pair |
| Patterns | Destructuring and exhaustive matching | switch (shape) { ... } |
| Class modifiers | Control over extension and implementation | sealed, final, base |
Concurrency with isolates and async code
Dart handles concurrency with isolates instead of shared-memory threads. Each isolate has its own heap and a single-threaded event loop, and isolates communicate only by passing messages through ports. This design eliminates data races and most locking problems by construction.
Within one isolate, asynchronous work uses Future, Stream and the async and await keywords. Waiting for a network response therefore does not block the user interface, but CPU-heavy work such as parsing a large JSON file still blocks the event loop unless it moves to a background isolate, for example with Isolate.run.
How Dart compares with related languages
Dart competes most directly with Kotlin, Swift, TypeScript and JavaScript for client application work. Its distinguishing feature is one codebase for several platforms, whereas Kotlin and Swift are primarily tied to Android and Apple ecosystems.
| Language | Typing | Main runtime targets | Typical strength |
|---|---|---|---|
| Dart | Static, sound, null-safe | Native code, JavaScript, Wasm | Cross-platform UI with Flutter |
| Kotlin | Static, null-safe | JVM, Android, native, JavaScript | Android and server development |
| Swift | Static, null-safe | Native code for Apple platforms | iOS and macOS applications |
| TypeScript | Static but unsound | JavaScript | Large web codebases |
| JavaScript | Dynamic | Browsers, Node.js | Universal web reach |
A frequent misconception is that Dart is only a Flutter language. It also runs command-line tools and server applications on the Dart VM, although its server ecosystem is far smaller than those of Go, Java or Node.js.
When to choose Dart and its limitations
Dart is the right choice when a team wants one user interface codebase for iOS, Android, web and desktop. It is a weaker choice when a project depends on a large existing ecosystem in another language or needs deep platform-specific integration on a single operating system.
| Situation | Recommendation | Reason |
|---|---|---|
| Cross-platform mobile app | Dart with Flutter | Shared UI and logic, native AOT performance |
| Single-platform iOS app | Usually Swift | Direct access to newest Apple APIs |
| SEO-heavy content website | Usually HTML and JavaScript | Flutter web renders to a canvas |
| Command-line tooling | Dart is viable | Single native executable output |
| Data science work | Usually Python | Far richer library ecosystem |
- Package ecosystem size: pub.dev is strong for Flutter but thinner for server, scientific and enterprise libraries.
- Native interop overhead: platform features require plugins, platform channels or
dart:ffibindings. - Binary size: AOT applications bundle the runtime and framework, adding several megabytes.
- Isolate cost: spawning isolates and copying messages is heavier than sharing memory between threads.
Origins and evolution of the language
Google announced Dart in 2011 as a structured alternative for web development, and Dart 1.0 shipped in 2013 with an optional type system. Browser vendors never adopted a native Dart VM, so the language found its lasting role when Flutter selected Dart for its fast reload cycle and AOT output.
Dart 2 (2018) made the type system sound, Dart 2.12 (2021) introduced sound null safety, and Dart 3 (2023) made null safety mandatory while adding records, patterns and class modifiers. Each major step improved reliability and compiler optimization at the price of migration work for older code.
In everyday language
Dart is a language for writing apps, made by Google. Its main appeal is that a team can write an app once and run it on phones, computers and the web. While programmers work, Dart lets them see changes almost instantly. When the app is finished, Dart turns it into fast code that each device understands directly.
Think of it as writing one recipe that every kitchen can cook from, with a strict checker that catches missing ingredients before cooking starts. That checking is a big part of why Dart apps tend to crash less from simple mistakes.
Seen in the real world
A regional bank with a small mobile team needs a new customer app for both iOS and Android. Instead of hiring two separate teams for Swift and Kotlin, it writes the app in Dart with Flutter. Developers use hot reload to adjust screens during design reviews, and sound null safety catches missing account fields at compile time rather than in production.
For release, the code is compiled ahead of time to ARM machine code for both stores. Balance calculations that parse large transaction histories run in a background isolate, so scrolling stays smooth. The bank ships one codebase to two platforms and keeps feature parity between them with roughly the staff a single native team would need.