Dart (programming language)

Dart is a programming language designed by Lars Bak and Kasper Lund and developed by Google.

Uses your system voice; voice and rate in settings.

≈ 7 min read

Cite, export and learn8 citation formats · 8 exports · lesson and quiz

Names in other languages

No names in other languages are held for this entry yet.

Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.

Dart is a programming language designed by Lars Bak and Kasper Lund and developed by Google. It can be used to develop web and mobile apps as well as server and desktop applications. Dart is an object-oriented, class-based, garbage-collected language with C-style syntax.

It can compile to machine code, JavaScript, or WebAssembly. It supports interfaces, mixins, abstract classes, reified generics and type inference. The latest version of Dart is .

History

Dart was unveiled at the GOTO conference in Aarhus, Denmark, October 10–12, 2011. Lars Bak and Kasper Lund founded the project. Dart 1.0 was released on November 14, 2013.

Dart had a mixed reception at first. Some criticized the Dart initiative for fragmenting the web because of plans to include a Dart VM in Chrome. Those plans were dropped in 2015 with the Dart 1.9 release.

Focus changed to compiling Dart code to JavaScript. Dart 2.0 was released in August 20181 with language changes including a type system. In November 2019, Dart 2.6 introduced a new extension, dart2native .

This extended native compilation to the Linux, macOS, and Windows desktop platforms. Earlier developers could create new tools using only Android or iOS devices. With this extension, developers could deploy a program into self-contained executables.

The Dart SDK doesn't need to be installed to run these self-contained executables. The Flutter toolkit integrates Dart, so it can compile on small services like backend support. Dart 3.0 was released in May 20231 with changes to the type system to require sound null safety.

This release included new features like records, patterns, and class modifiers. Dart can compile to WebAssembly since version 3.4.

Deploying apps

The Dart software development kit (SDK) ships with a standalone Dart runtime. This allows Dart code to run in a command-line interface environment. The SDK includes tools to compile and package Dart apps.

Dart ships with a complete standard library allowing users to write fully working system apps like custom web servers. Developers can deploy Dart apps in six ways: $ cd $ webdev serve [--debug] [-o ] To create production apps, run webdev build to compile a minified JavaScript file. $ cd $ webdev build [-o ] $ dart compile exe "source.dart" -o "target_app" Generated: $ ./target_app $ dart compile aot-snapshot "source.dart" Generated $ dartaotruntime "target_app.aot" $ dart compile jit-snapshot "source.dart" Compiling to jit-snapshot file Hello world! $ dart run "target_app.jit" Hello world! $ dart compile kernel "source.dart" Compiling to kernel file . $ dart run "target_app.dill"

Data storage

Snapshot files, a core part of the Dart VM, store objects and other runtime data. Script snapshots Dart programs can be compiled into snapshot files containing all of the program code and dependencies preparsed and ready to execute, allowing fast startups. Full snapshots The Dart core libraries can be compiled into a snapshot file that allows fast loading of the libraries.

Most standard distributions of the main Dart VM have a prebuilt snapshot for the core libraries that is loaded at runtime. Object snapshots Dart uses snapshots to serialize messages that it passes between isolates. As a very asynchronous language, Dart uses isolates for concurrency.

An object generates a snapshot, transfers it to another isolate, then the isolate deserializes it.

Editors

On November 18, 2011, Google released Dart Editor, an open-source program based on Eclipse components, for macOS, Windows, and Linux-based operating systems. The editor supports syntax highlighting, code completion, JavaScript compiling, running web and server Dart applications, and debugging. On August 13, 2012, Google announced the release of an Eclipse plugin for Dart development.

On April 18, 2015, Google retired the Dart Editor in favor of the JetBrains integrated development environment (IDE). Android Studio, IntelliJ IDEA, PyCharm, PhpStorm and WebStorm support a Dart plugin. This plugin supports many features such as syntax highlighting, code completion, analysis, refactoring, debugging, and more.

Other editors include plugins for Dart including Sublime Text, Atom, Emacs, Vim and Visual Studio Code.

Chrome Dev Editor

In 2013, the Chromium team began work on an open source, Chrome App-based development environment with a reusable library of GUI widgets, codenamed Spark. The project was later renamed as Chrome Dev Editor. Built in Dart, it contained Spark which is powered by Polymer.

In June 2015, Google transferred the CDE project to GitHub as a free software project and ceased active investment in CDE. The Chrome Dev Editor project was archived on April 24, 2021.

DartPad

To provide an easier way to start using Dart, the Dart team created DartPad at the start of 2015. This online IDE allows developers to experiment with Dart application programming interfaces (APIs) and run Dart code. It provides syntax highlighting, code analysis, code completion, documentation, and HTML and CSS editing.

Example

A Hello, World! example: void main() { print('Hello, World!'); } A simple for-loop: void main() { for (int i = 1; i A function to calculate the nth Fibonacci number: void main() { int i = 20; print('fibonacci($i) = ${fibonacci(i)}'); } /// Computes the nth Fibonacci number. int fibonacci(int n) { return n A simple class: // Import the math library to get access to the sqrt function. // Imported with `math` as name, so accesses need to use `math.` as prefix. import 'dart:math' as math; // Create a class for Point. class Point { // Final variables cannot be changed once they are assigned. // Declare two instance variables. final num x, y; // A constructor, with syntactic sugar for setting instance variables. // The constructor has two mandatory parameters. Point(this.x, this.y); // A named constructor with an initializer list.

Point.origin(): x = 0, y = 0; // A method. num distanceTo(Point other) { num dx = x - other.x; num dy = y - other.y; return math.sqrt(dx * dx + dy * dy); } // Example of a "getter". // Acts the same as a final variable, but is computed on each access. num get magnitude => math.sqrt(x * x + y * y); // Example of operator overloading Point operator +(Point other) => Point(x + other.x, y + other.y); // When instantiating a class such as Point in Dart 2+, new is // an optional word } // All Dart programs start with main(). void main() { // Instantiate point objects. Point p1 = Point(10, 10); print(p1.magnitude); Point p2 = Point.origin(); num distance = p1.distanceTo(p2); print(distance); }

Influences from other languages

Dart belongs to the ALGOL language family. Its members include C, Java, C#, JavaScript, and others. The method cascade syntax was adopted from Smalltalk.

This syntax provides a shortcut for invoking several methods one after another on the same object. Dart's mixins were influenced by Strongtalk and Ruby. Dart makes use of isolates as a concurrency and security unit when structuring applications.

The Isolate concept builds upon the Actor model implemented in Erlang. In a 2004 paper, Gilad Bracha (who was a member of the Dart team) and David Ungar first proposed Mirror API for performing controlled and secure reflection. The concept was first implemented in Self.

See also

Google Web Toolkit TypeScript, a strongly-typed programming language that transpiles to JavaScript Flutter, an open-source UI software development kit for cross-platform applications

DartPad

Text derived from https://en.wikipedia.org/w/index.php?oldid=1368937580 under CC BY-SA 4.0; modifications have been made.

Words in each sectionExampleExampleExample: 258 words258HistoryHistoryHistory: 209 words209Deploying appsDeploying appsDeploying apps: 151 words151Data storageData storageData storage: 120 words120EditorsEditorsEditors: 116 words116Influences from other l…Influences from other languagesInfluences from other languages: 109 words109Chrome Dev EditorChrome Dev EditorChrome Dev Editor: 76 words76DartPadDartPadDartPad: 50 words50See alsoSee alsoSee also: 22 words22
Words in each section. Measured from the stored article body; sections below the minimum are not plotted.

References

1 claim could not be tied to a specific sentence and is listed in the table below instead.

  1. ↩Wikipedia “Dart (programming language)” revision 1368937580 · retrieved 2026-10-20 release date (×2) · confidence 0.95 revision URL

Provenance

snapshot enwiki-001368937580 · captured 2026-08-11 · ledger · version history

Cite this page as: encyclopegia.org, “Dart (programming language)”, snapshot enwiki-001368937580. https://encyclopegia.org/a/dart-programming-language