dart (Dart VM)

    Here’s an example of running a Dart file on the command line:

    Options

    Common command-line options for dart include:

    • —enable-asserts
    • Enables assert statements. When asserts are enabled, anchecks a boolean condition, raising an exception if the condition is false.
    • —packages=<path>
    • Specifies the path to the package resolution configuration file.For more information, seePackage Resolution Configuration File.This option cannot be used with —package-root.
    • -p <path> or -package-root=<path>
    • Specifies where to find imported libraries.This option cannot be used with .
    • Sets the upper limit of to <num> MB.
    • —version
    • Displays VM version information.
    • -h or —help
    • Displays help. (Add -v for information about all options.)
    • —enable-vm-service
    • Enables Observatory on localhost port 8181.
    • —enable-vm-service=<port>
    • Enables Observatory on localhost for the specific port.
    • —pause-isolates-on-exit
    • Causes the VM to pause each isolate that would otherwise exit.If your standalone app executes quickly,it might exit before you can open Observatory. To avoid this situation,specify this flag on startup. You must explicitly release all isolatesin the Observatory debugger.
    • —pause-isolates-on-start
    • Causes the VM to pause before starting any isolate.You must explicitly start each isolate in the.
    • —observe
    • A shortcut that combines —enable-vm-service and—pause-isolates-on-exit.
    • —profile
    • On Windows, Observatory’sCPU Profiler screenis disabled by default. Use this option to enable it.

    The following is an example Observatory run:

    1. $ dart --observe <script>.dart

    Snapshot option

    You can also generate snapshots: