From quick prototypes to serious apps

Dart's optional types let you prototype quickly and then revise your code to be more maintainable.

Wherever you need structured code

You can use the same Dart code in most modern web browsers (Chrome, Safari 5+, Firefox 4+) and on servers. Look for more browser support shortly.

Familiar yet new

Dart code should look familiar if you know a language or two, and you can use time-tested features such as classes and closures. Dart's new features make it easier for you to develop and maintain software. Dart is still in the early stages of development, so please take a look and tell us what you think.

Examples of Dart code

The Dart code below is inside an app called Dartboard. If you click the Run button at Dartboard's upper left—go ahead, you know you want to—you'll see the expected output (Hello, Dart!) at the bottom.

main() { print('Hello, Dart!'); }
main() {
  print('Hello, Dart!');
}
int fib(int n) {
  if (n <= 1) return n;
  return fib(n - 1) + fib(n - 2);
}

main() {
  print('fib(20) = ${fib(20)}');
}
class Point {
  Point(this.x, this.y);
  distanceTo(Point other) {
    var dx = x - other.x;
    var dy = y - other.y;
    return Math.sqrt(dx * dx + dy * dy);
  }
  var x, y;
}

main() {
  Point p = new Point(2, 3);
  Point q = new Point(3, 4);
  print('distance from p to q = ${p.distanceTo(q)}');
}
class Printer extends Isolate {
  main() {
    port.receive((message, replyTo) {
      if (message == null) port.close();
      else print(message);
    });
  }
}

main() {
  new Printer().spawn().then((port) {
    for (var message in ['Hello', 'from', 'other', 'isolate']) {
      port.send(message);  
    }
    port.send(null);
  });
} 

What next?

Follow a tutorial, or read the technical overview.