Ajax in Dart

We start our Dart application by loading a couple of Dart libraries with a main function in scripts/comics.dart.

your_first_dart_app/web/scripts/skel.dart
 
import​ ​'dart:html'​;
 
import​ ​'dart:convert'​;
 
main() {
 
// Do stuff here
 
}

As you’ll see in Chapter 10, Libraries, there is a lot of power in those import statements. For now, we can simply think of them as a means for pulling in functionality outside of the core Dart behavior.

All Dart applications use main as the entry point for execution. Simply writing code and expecting it to run, as we do in JavaScript, will not work here. It might seem C-like at first, but does it honestly make sense that code lines strewn across any number of source files and HTML will all ...

Get Dart 1 for Everyone now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.