| OLD | NEW |
| 1 --- | 1 --- |
| 2 layout: default | 2 layout: homepage |
| 3 header: | |
| 4 css: ["/css/dartboard.css"] | |
| 5 --- | 3 --- |
| 6 | 4 |
| 7 <h2> A new platform for structured web apps</h2> | 5 <article class="homepage"> |
| 8 | 6 |
| 9 <section> | 7 <section> |
| 10 » » | 8 |
| 11 <div class="homepage-intro"> | 9 <div class="row" id="top-mast"> |
| 12 <p> | 10 <div class="span12 contents"> |
| 13 With the Dart platform, | 11 <img class="logo" src="/imgs/dart-logo.png" width="268" height="116"> |
| 14 you can write code | 12 <h1> |
| 15 that runs on servers and in modern web browsers. | 13 Build HTML5 apps for the modern web |
| 16 Dart compiles to JavaScript, | 14 </h1> |
| 17 so your Dart web apps will work in multiple browsers | 15 <p> |
| 18 (not just ours). | 16 Dart brings structure to web app engineering |
| 19 </p> | 17 with a new language, libraries, and tools. |
| 20 | 18 </p> |
| 21 <p> | 19 <div> |
| 22 The Dart platform includes | 20 <ul class="buttons"> |
| 23 a language, libraries, an editor, | 21 <li class="download"> |
| 24 a virtual machine (VM) | 22 <a href="/downloads.html" class="btn btn-primary btn-large"> Downloa
d now </a> |
| 25 for both servers and browsers, | 23 </li> |
| 26 and a compiler to JavaScript. | 24 <li> |
| 27 </p> | 25 <div class="g-plus" data-width="170" data-height="69" data-href="//p
lus.google.com/109866369054280216564?rel=publisher"></div> |
| 28 | 26 </li> |
| 29 <p> | 27 <li class="twitter"> |
| 30 Dart is still in preview, so | 28 <a href="https://twitter.com/dart_lang" class="twitter-follow-button
" data-show-count="false" data-size="large">Follow @dart_lang</a> |
| 31 try it out and tell us what you think. | 29 </li> |
| 32 </p> | 30 </ul> |
| 33 | 31 </div> |
| 34 {% comment %} | 32 </div> |
| 35 <!-- Important announcement? Put it here. --> | |
| 36 <p style="border-radius: 5px; background-color: #55DDCA; padding: 5px"> | |
| 37 <strong>New!</strong> ANNOUNCE SOMETHING GREAT AND LINK TO MORE INFO. | |
| 38 </p> | |
| 39 {% endcomment %} | |
| 40 </div> | 33 </div> |
| 41 | 34 |
| 42 <script src="http://feeds.feedburner.com/DartNewsUpdates?format=sigpro" type="
text/javascript" ></script><noscript><p>Subscribe to RSS headline updates from:
<a href="http://feeds.feedburner.com/DartNewsUpdates"></a></p> </noscript> | |
| 43 </section> | 35 </section> |
| 44 | 36 |
| 45 | |
| 46 <section> | 37 <section> |
| 47 <h2>Get started</h2> | 38 |
| 48 | 39 <div class="row callouts"> |
| 49 <p> | 40 <div class="span4"> |
| 50 Read a <a href="/docs/technical-overview/">technical overview</a>, | 41 <h2><i class="icon-ok"></i> Familiar</h2> |
| 51 take a <a href="/language-tour/">language tour</a>, or | 42 <p> |
| 52 download <a href="/docs/editor/getting-started/">Dart Editor</a>. | 43 Dart is a <strong>class-based, object-oriented language</strong> |
| 53 Or play with Dart code right here in your browser. | 44 with lexical scope, closures, and optional typing. |
| 54 </p> | 45 Dart addresses issues with current web programming languages |
| 55 | 46 and is <strong>easy to learn</strong> for a wide range of developers. |
| 56 | 47 <a href="#structured-language">Learn more</a> |
| 57 <div id="samples"> | 48 </p> |
| 58 <label for="samples-list" style="display:none">Dart code examples:</label> | 49 <div class="visible-desktop"> |
| 59 <select id="samples-list"> | 50 {% highlight dart %} |
| 60 <option value="hello">Hello, Dart!</option> | 51 #import('dart:html'); |
| 61 <option value="fib">Fibonacci</option> | 52 |
| 62 <option value="point">Point</option> | 53 main() { |
| 63 </select> | 54 var msg = query('#msg'); |
| 55 var btn = new ButtonElement(); |
| 56 btn.on.click.add((e) => msg.text = 'Dart!'); |
| 57 document.nodes.add(btn); |
| 58 } |
| 59 {% endhighlight %} |
| 64 </div> | 60 </div> |
| 65 | 61 <div class="visible-tablet visible-phone"> |
| 66 <code id="samples-editor" class="codes for-samples">main() { | 62 {% highlight dart %} |
| 67 print('Hello, Dart!'); | 63 #import('dart:html'); |
| 68 }</code> | 64 |
| 69 | 65 main() { |
| 70 {% include samples.html %} | 66 var msg = query('#msg'); |
| 67 var btn = new ButtonElement(); |
| 68 btn.on.click.add((e) { |
| 69 msg.text = 'Dart!' |
| 70 }); |
| 71 document.nodes.add(btn); |
| 72 } |
| 73 {% endhighlight %} |
| 74 </div> |
| 75 </div> |
| 76 |
| 77 <div class="span4"> |
| 78 <h2><i class="icon-cogs"></i> Productive</h2> |
| 79 <p> |
| 80 Dart Editor and the SDK provide |
| 81 an <strong>integrated development and debugging</strong> experience. The
editor |
| 82 supports refactoring, breakpoints, code completion, code |
| 83 navigation, and more. The SDK contains the stand-alone virtual |
| 84 machine, a <strong>package manager</strong>, and Chromium with an embedd
ed |
| 85 Dart VM. |
| 86 <a href="#productive-tools">Learn more</a> |
| 87 </p> |
| 88 <p class="img"> |
| 89 <img src="/imgs/homepage/editor-full.png"> |
| 90 </p> |
| 91 </div> |
| 92 |
| 93 <div class="span4"> |
| 94 <h2><i class="icon-globe"></i> Ubiquitous</h2> |
| 95 <p> |
| 96 Dart <strong>compiles to JavaScript</strong>, |
| 97 so you can use it for web apps in all modern desktop and mobile browsers
. |
| 98 Our JavaScript compiler generates minimal code thanks to tree-shaking. |
| 99 Dart apps can also <strong>run on the server</strong>, in a stand-alone |
| 100 Dart VM. |
| 101 </p> |
| 102 <p class="img"> |
| 103 <img src="/imgs/homepage/server-desktop-phone.png"> |
| 104 </p> |
| 105 </div> |
| 106 </div> <!-- /.row --> |
| 107 |
| 71 </section> | 108 </section> |
| 72 | 109 |
| 73 <script async type="text/javascript" | 110 <section> |
| 74 src="http://try.dartlang.org/dartboard.dart.app.js"> | 111 |
| 75 </script> | 112 <div class="row callouts"> |
| 76 | 113 <div class="span4"> |
| 77 | 114 <h2><i class="icon-play"></i> Start</h2> |
| 115 <ul> |
| 116 <li><a href="/docs/editor/">Get the editor and SDK</a></li> |
| 117 <li><a href="/docs/technical-overview/">Read the technical overview</a><
/li> |
| 118 <li><a href="/samples/">Tour the samples</a></li> |
| 119 <li><a href="http://www.youtube.com/watch?v=vT1KmTQ-1Os" |
| 120 title="Introduction to Dart">Watch an intro video</a></li> |
| 121 </ul> |
| 122 </div> |
| 123 |
| 124 <div class="span4"> |
| 125 <h2><i class="icon-book"></i> Learn</h2> |
| 126 <ul> |
| 127 <li><a href="/docs/language-tour/">Follow the language tour</a></li> |
| 128 <li><a href="/docs/library-tour/">Follow the library tour</a></li> |
| 129 <li><a href="http://synonym.dartlang.org/">See synonyms to JavaScript</a
></li> |
| 130 <li><a href="http://shop.oreilly.com/product/0636920025887.do">Read a fr
ee eBook</a></li> |
| 131 <li><a href="/slides/2012/06/io12/Bullseye-Your-first-Dart-app-Codelab-G
oogleIO2012.pdf">Practice a codelab</a></li> |
| 132 </ul> |
| 133 </div> |
| 134 |
| 135 <div class="span4"> |
| 136 <h2><i class="icon-comments"></i> Participate</h2> |
| 137 <ul> |
| 138 <li><a href="/mailing-list">Send feedback to the mailing list</a></li> |
| 139 <li><a href="https://plus.google.com/109866369054280216564/posts">Follow
on G+</a> |
| 140 and <a href="http://twitter.com/dart_lang">Twitter</a></li> |
| 141 <li><a href="http://stackoverflow.com/questions/tagged/dart">Get answers
at Stack Overflow</a></li> |
| 142 <li><a href="http://dartbug.com/new">File feature requests and bugs</a><
/li> |
| 143 <li><a href="http://code.google.com/p/dart/wiki/Contributing">Submit a p
atch</a></li> |
| 144 </ul> |
| 145 </div> |
| 146 </div> |
| 147 |
| 148 </section> |
| 149 |
| 150 <div class="overview-transition"> |
| 151 <hr> |
| 152 <h1>Overview</h1> |
| 153 </div> |
| 154 |
| 155 <section id="structured-language"> |
| 156 |
| 157 <div class="page-header"> |
| 158 <h1>A structured language <small>that's flexible and familiar</small></h1> |
| 159 </div> |
| 160 |
| 161 <div class="row" id="language-features"> |
| 162 <div class="span12"> |
| 163 <p> |
| 164 Dart addresses issues with traditional web development languages |
| 165 while remaining easy to learn. Thanks to optional types, Dart |
| 166 scales from simple scripts to large apps. Learn more with the |
| 167 <a href="/docs/language-tour/" title="Dart Language Tour">language tour<
/a>, or read the |
| 168 <a href="/docs/spec/" title="Dart Language Specification">language spec<
/a>. |
| 169 </p> |
| 170 |
| 171 <ul class="nav nav-tabs"> |
| 172 <li class="active"><a href="#lang-classes" data-toggle="tab">Classes</a>
</li> |
| 173 <li><a href="#lang-lexical-closures" data-toggle="tab">Lexical closures<
/a></li> |
| 174 <li><a href="#lang-libraries" data-toggle="tab">Libraries</a></li> |
| 175 <li><a href="#lang-optional-static-types" data-toggle="tab">Optional sta
tic types</a></li> |
| 176 <li><a href="#lang-named-params" data-toggle="tab">Named parameters</a><
/li> |
| 177 <li><a href="#lang-isolates" data-toggle="tab">Isolates</a></li> |
| 178 <li><a href="#lang-more" data-toggle="tab">More</a></li> |
| 179 </ul> |
| 180 |
| 181 <div class="tab-content"> |
| 182 <div class="tab-pane active" id="lang-classes"> |
| 183 <div class="row"> |
| 184 <div class="span6"> |
| 185 {% highlight dart %} |
| 186 class Point { |
| 187 final num x, y; |
| 188 |
| 189 Point(this.x, this.y); |
| 190 Point.zero() : x = 0, y = 0; // Named constructor |
| 191 // with an initializer list. |
| 192 |
| 193 num distanceTo(Point other) { |
| 194 var dx = x - other.x; |
| 195 var dy = y - other.y; |
| 196 return Math.sqrt(dx * dx + dy * dy); |
| 197 } |
| 198 } |
| 199 {% endhighlight %} |
| 200 </div> |
| 201 <div class="span6"> |
| 202 <h2>Classes</h2> |
| 203 <p> |
| 204 Dart supports classes as a fundamental structural |
| 205 building block for libraries and apps. Classes define |
| 206 the structure of an object, and you can extend them to create |
| 207 more specialized definitions. New features |
| 208 such as <a href="/articles/m1-language-changes/#no-explicit-in
terfaces">implicit interfaces</a> and |
| 209 <a href="http://www.dartlang.org/docs/language-tour/#named-con
structors">named constructors</a>, |
| 210 make it easier to |
| 211 say more while typing less. |
| 212 Learn more about <a href="/docs/language-tour/#classes">classe
s in Dart</a>. |
| 213 </p> |
| 214 </div> |
| 215 </div> |
| 216 </div> <!-- /.tab-pane --> |
| 217 |
| 218 <div class="tab-pane" id="lang-lexical-closures"> |
| 219 <div class="row"> |
| 220 <div class="span6"> |
| 221 {% highlight dart %} |
| 222 makeAdder(num x) { |
| 223 return (num y) => x + y; |
| 224 } |
| 225 |
| 226 main() { |
| 227 var add2 = makeAdder(2); |
| 228 assert(add2(3) == 5); |
| 229 } |
| 230 {% endhighlight %} |
| 231 </div> |
| 232 <div class="span6"> |
| 233 <h2>Lexical closures</h2> |
| 234 <p> |
| 235 Dart has lexical scoping and a convenient closure |
| 236 mechanism. The <code>makeAdder</code> function returns a |
| 237 new function that closes around <code>x</code>. |
| 238 The <code>=></code> syntax is syntactic |
| 239 sugar for a one-line function with a return value. |
| 240 </p> |
| 241 </div> |
| 242 </div> |
| 243 </div> <!-- /.tab-pane --> |
| 244 |
| 245 <div class="tab-pane" id="lang-libraries"> |
| 246 <div class="row"> |
| 247 <div class="span3"> |
| 248 {% highlight dart %} |
| 249 // In widget.dart |
| 250 |
| 251 #library('widget'); |
| 252 |
| 253 class Widget { |
| 254 // ... |
| 255 } |
| 256 {% endhighlight %} |
| 257 </div> |
| 258 <div class="span3"> |
| 259 {% highlight dart %} |
| 260 // In toolkit.dart |
| 261 |
| 262 #library('toolkit'); |
| 263 #import('widget.dart'); |
| 264 |
| 265 class Window extends Widget { |
| 266 // ... |
| 267 } |
| 268 {% endhighlight %} |
| 269 </div> |
| 270 <div class="span6"> |
| 271 <h2>Libraries</h2> |
| 272 <p> |
| 273 Use libraries to create reusable modules of functionality. |
| 274 Libraries can import other libraries, making it easy to |
| 275 publish and share code. |
| 276 </p> |
| 277 </div> |
| 278 </div> |
| 279 </div> <!-- /.tab-pane --> |
| 280 |
| 281 <div class="tab-pane" id="lang-optional-static-types"> |
| 282 <div class="row"> |
| 283 <div class="span6"> |
| 284 {% highlight dart %} |
| 285 class Point { |
| 286 final num x, y; |
| 287 Point(this.x, this.y); |
| 288 // use types (num and Point) for |
| 289 // the "surface area" of your code |
| 290 num distanceTo(Point other) { |
| 291 // var declares an |
| 292 // untyped dynamic variable |
| 293 var dx = x - other.x; |
| 294 var dy = y - other.y; |
| 295 return Math.sqrt(dx * dx + dy * dy); |
| 296 } |
| 297 } |
| 298 {% endhighlight %} |
| 299 </div> |
| 300 <div class="span6"> |
| 301 <h2>Optional static types</h2> |
| 302 <p> |
| 303 Think of Dart's static types as annotations or documentation |
| 304 that help clearly indicate your intent, without getting in |
| 305 your way. Use types when you want more help from your tools, |
| 306 or if you want to make it easier to understand how to use your |
| 307 code. Omit the type annotations if you're just scripting aroun
d or |
| 308 if you're trying to express something that is challenging to |
| 309 express with a single type annotation. |
| 310 Type annotations don't affect the runtime semantics. Learn mor
e about |
| 311 <a href="http://www.dartlang.org/articles/optional-types/">opt
ional |
| 312 types in Dart</a>. |
| 313 </p> |
| 314 </div> |
| 315 </div> |
| 316 </div> <!-- /.tab-pane --> |
| 317 |
| 318 <div class="tab-pane" id="lang-named-params"> |
| 319 <div class="row"> |
| 320 <div class="span6"> |
| 321 {% highlight dart %} |
| 322 flipFlags([bool on, bool up, bool hidden=false]) { |
| 323 // ... |
| 324 } |
| 325 |
| 326 flipFlags(on: true, up: false, hidden: true); |
| 327 |
| 328 // Named params are also optional params |
| 329 flipFlags(on: true); // up == null, hidden == false |
| 330 {% endhighlight %} |
| 331 </div> |
| 332 <div class="span6"> |
| 333 <h2>Named parameters</h2> |
| 334 <p> |
| 335 The meaning of <code>true</code> |
| 336 or <code>false</code> is hard to decipher without context. |
| 337 Using named parameters, you can write code that is easier |
| 338 to understand. |
| 339 As a bonus, named parameters are also optional parameters. |
| 340 </p> |
| 341 </div> |
| 342 </div> |
| 343 </div> <!-- /.tab-pane --> |
| 344 |
| 345 <div class="tab-pane" id="lang-isolates"> |
| 346 <div class="row"> |
| 347 <div class="span6"> |
| 348 {% highlight dart %} |
| 349 #import('dart:isolate'); |
| 350 |
| 351 echo() { |
| 352 port.receive((msg, SendPort replyTo) { |
| 353 replyTo.send("Echo: $msg"); |
| 354 }); |
| 355 } |
| 356 |
| 357 main() { |
| 358 SendPort echoService = spawnFunction(echo); |
| 359 echoService.call("Hello!").then((answer) => print(answer)); |
| 360 } |
| 361 {% endhighlight %} |
| 362 </div> |
| 363 <div class="span6"> |
| 364 <h2>Isolates</h2> |
| 365 <p> |
| 366 Create isolates for concurrent programming and to |
| 367 run third-party code more securely. Communicate between |
| 368 isolates by passing messages that are copied before |
| 369 received to ensure no state is ever shared. Dart uses |
| 370 isolates instead of shared-state threads for safer |
| 371 parallel programming. |
| 372 </p> |
| 373 <p> |
| 374 The <code>echo()</code> function is run in an isolate, |
| 375 which is created with <code>spawnFunction</code>. |
| 376 A message is sent by <code>call</code> and an answer |
| 377 is printed. |
| 378 </p> |
| 379 </div> |
| 380 </div> |
| 381 </div> <!-- /.tab-pane --> |
| 382 |
| 383 <div class="tab-pane" id="lang-more"> |
| 384 <p> |
| 385 The Dart language contains many more useful and productive |
| 386 features. |
| 387 Check out a sample: |
| 388 </p> |
| 389 <ul> |
| 390 <li>better asynchronous programming with |
| 391 <a href="/docs/library-tour/#asynchronous-programming">Futures</a>
</li> |
| 392 <li>more explicit collections with <a href="/docs/language-tour/#g
enerics">generics</a></li> |
| 393 <li>better <a href="/docs/language-tour/#for-loops">for loops</a><
/li> |
| 394 <li>error handling with <a href="/docs/language-tour/#exceptions">
exceptions</a></li> |
| 395 </ul> |
| 396 |
| 397 <p> |
| 398 Learn more about the Dart language by taking |
| 399 a <a href="/docs/language-tour/">Language Tour</a>, |
| 400 or reading the <a href="/docs/spec/">Dart Language Spec</a>. |
| 401 </p> |
| 402 </div> <!-- /.tab-pane --> |
| 403 |
| 404 </div> <!-- /.tab-content --> |
| 405 </div> <!-- /.span12 --> |
| 406 </div> <!-- /#language-features --> |
| 407 |
| 408 </section> |
| 409 |
| 410 <section id="productive-tools"> |
| 411 |
| 412 <div class="page-header"> |
| 413 <h1>Productive and integrated tools <small>for faster development</small></h
1> |
| 414 </div> |
| 415 |
| 416 <p> |
| 417 Gone are the days of building web apps with plain text editors. |
| 418 <a href="/docs/editor/">Dart Editor</a>, its static analysis engine, |
| 419 and direct integration with Chromium+DartVM |
| 420 helps you develop, debug, and maintain your apps. |
| 421 </p> |
| 422 |
| 423 <p> |
| 424 Dart also ships a stand-alone |
| 425 <a href="/docs/sdk/">Dart SDK</a> that contains the |
| 426 <a href="/docs/dart2js/">dart2js compiler</a>, |
| 427 the <a href="/docs/standalone-dart-vm/">Dart VM</a> |
| 428 for running command-line apps, and the |
| 429 <a href="/docs/pub-package-manager/">pub</a> package manager. |
| 430 </p> |
| 431 |
| 432 <ul class="thumbnails"> |
| 433 <li class="span6"> |
| 434 <div class="thumbnail"> |
| 435 <img src="/imgs/homepage/editor-code-completion.png" alt="Code completio
n in Dart Editor"> |
| 436 <h5>Code completion</h5> |
| 437 <p> |
| 438 Explore the methods and fields |
| 439 available to the object you're working on. |
| 440 </p> |
| 441 </div> |
| 442 </li> |
| 443 |
| 444 <li class="span6"> |
| 445 <div class="thumbnail"> |
| 446 <img src="/imgs/homepage/editor-refactor.png" alt="Refactoring in Dart E
ditor"> |
| 447 <h5>Refactoring</h5> |
| 448 <p> |
| 449 Change your code structure |
| 450 without changing the behavior. |
| 451 </p> |
| 452 </div> |
| 453 </li> |
| 454 |
| 455 <li class="span6"> |
| 456 <div class="thumbnail"> |
| 457 <img src="/imgs/homepage/editor-outline.png" alt="Code completion in Dar
t Editor"> |
| 458 <h5>Outline view</h5> |
| 459 <p> |
| 460 List the classes, |
| 461 methods, and functions |
| 462 in a simple tree display. |
| 463 </p> |
| 464 </div> |
| 465 </li> |
| 466 |
| 467 <li class="span6"> |
| 468 <div class="thumbnail"> |
| 469 <img src="/imgs/homepage/editor-debug.png" alt="Debugging in Dart Editor
"> |
| 470 <h5>Debugger</h5> |
| 471 <p> |
| 472 Set breakpoints, inspect variables, |
| 473 and step over, into, and out of code. |
| 474 </p> |
| 475 </div> |
| 476 </li> |
| 477 |
| 478 <li class="span6"> |
| 479 <div class="thumbnail"> |
| 480 <img src="/imgs/homepage/editor-warnings.png" alt="Static analysis warni
ngs in Dart Editor"> |
| 481 <h5>Static analysis</h5> |
| 482 <p> |
| 483 See warnings when inconsistencies and potential problems are detected. |
| 484 </p> |
| 485 </div> |
| 486 </li> |
| 487 |
| 488 <li class="span6"> |
| 489 <div class="thumbnail"> |
| 490 <img src="/imgs/homepage/editor-callers.png" alt="Find callers for metho
ds in Dart Editor"> |
| 491 <h5>Open callers</h5> |
| 492 <p> |
| 493 Quickly find all callers for a method, and easily jump to those locati
ons. |
| 494 </p> |
| 495 </div> |
| 496 </li> |
| 497 </ul> |
| 498 |
| 499 </section> |
| 500 |
| 501 </article> <!-- /.homepage --> |
| OLD | NEW |