Book Image

DART Essentials

Book Image

DART Essentials

Overview of this book

Table of Contents (16 chapters)
Dart Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

The standalone Dart VM


The Dart SDK comes with a standalone Dart VM to run command-line apps such as pub or dart2js. You can find it in <dart-sdk-dir>/bin/dart. It accepts command-line arguments such as -h for help or -c to enable the checked mode. There are also special options for the Observatory tool (we'll use it in Chapter 8, Testing and Profiling the Dart Code). These aren't very interesting for us now, but feel free to check out https://www.dartlang.org/tools/dart-vm/ for a complete list of all supported options.

The standalone Dart VM is mostly the same environment as the VM implemented in the Dartium browser. The entry point for an app is a top-level main()function, but this time, it accepts a list of arguments passed from the command line:

main(List<String> args) {
  /* ... */
}

With the standalone Dart VM, you can't use libraries specific to the browser environment, such as dart:html, of course. On the other hand, you can use dart:io to access the filesystem or create...