o7planning

Install Dart SDK on Windows

  1. Download Dart
  2. Dart setting
  3. Adding environment variable
  4. Write your first Dart example

1. Download Dart

.
  • Introduction to Dart
Google offers three channels for you to download Dart depending on your goals.
Stable Channel
Stable Channel allows you to download a stable version of Dart at a product level. You can use it without worrying about bugs in the code.
Beta Channel
Beta Channel allows you to download the version of Dart with the newest features which have not officially released yet because of the needs of more time for stability test. You can download this version if you desire to learn about the new features in advance.
Dev Channel
Dev Channel allows you to download the Dart version with all the features being developed by the Dart design team. This version is constantly changing and not stable.
To download Dart, access the link below.
After downloading it successfully, you will get a zip file.

2. Dart setting

Firstly, extract the zip file that you have already downloaded. For example, extract the C:/dart-sdk folder:
Next, open the bin folder of the dart-sdk in Windows Explorer. Enter the keyword "CMD" in the address bar and press Enter.A CMD window will open thereafter.
Then enter "dart" in the CMD window and press Enter. You will get a list of arguments of the "dart" command and their usage.
C:\dart-sdk\bin>dart
Usage: dart [<vm-flags>] <dart-script-file> [<script-arguments>]

Executes the Dart script <dart-script-file> with the given list of <script-arguments>.

Common VM flags:
--enable-asserts
  Enable assert statements.
--help or -h
  Display this message (add -v or --verbose for information about
  all VM options).
--packages=<path>
  Where to find a package spec file.
--observe[=<port>[/<bind-address>]]
  The observe flag is a convenience flag used to run a program with a
  set of options which are often useful for debugging under Observatory.
  These options are currently:
      --enable-vm-service[=<port>[/<bind-address>]]
      --pause-isolates-on-exit
      --pause-isolates-on-unhandled-exceptions
      --warn-on-pause-with-no-debugger
  This set is subject to change.
  Please see these options (--help --verbose) for further documentation.
--write-service-info=<file_uri>
  Outputs information necessary to connect to the VM service to the
  specified file in JSON format. Useful for clients which are unable to
  listen to stdout for the Observatory listening message.
--snapshot-kind=<snapshot_kind>
--snapshot=<file_name>
  These snapshot options are used to generate a snapshot of the loaded
  Dart script:
    <snapshot-kind> controls the kind of snapshot, it could be
                    kernel(default) or app-jit
    <file_name> specifies the file into which the snapshot is written
--version
  Print the SDK version.

3. Adding environment variable

You also need to add the Dart path to the Environment Variable, which is necessary for you to use the Dart SDK from anywhere on your computer.
Press WIN + R to bring up the RUN window.
Enter the command below to open the Environment Variables window:
rundll32.exe sysdm.cpl,EditEnvironmentVariables
Select "Path" variable and press "Edit":
Now you can use the "dart" command from any folders on your computer.
Note: You may need to restart your computer for the changes to take effect.

4. Write your first Dart example