- Dart Cookbook
- Ivo Balbaert
- 355字
- 2021-08-05 17:42:44
Configuring the Dart environment
This recipe will help customize the Dart environment according to our requirements. Here, we configure the following:
- Defining a
DART_SDK
environment variable - Making
dart-sdk\bin
available for the execution of the Dart command-line tools
Getting ready
We assume that you have a working Dart environment installed on your machine. If not, go to is the complete bundle. Downloading and uncompressing it will produce a folder named dart
, which will contain everything you need. Put this in a directory of your choice. This could be anything, but for convenience keep it short, such as d:\dart
on Windows or ~/dart
on Linux. On OS X, you can just drop the directory in the App
folder.
How to do it...
- Create a
DART_SDK
environment variable that contains the path to thedart-sdk
folder. On Windows, create and setDART_SDK
tod:\dart\dart-sdk
or<your-dart-sdk-path>\dart-sdk
when using a dart from another folder (if you need more information on how to do this, refer to http://www.c-sharpcorner.com/UploadFile/6cde20/use-of-environment-variable-in-windows-8/). On Linux, add this to your configuration file.bashrc
and/or.profile
using theexport DART_SDK=~/dart/dart-sdk
code. On OS X, exportDART_SDK=/Applications/dart/dart-sdk
or in general exportDART_SDK=/path/to/dart-sdk
. - The installation directory has a subfolder
dart-sdk\bin
, which contains the command-line tools. Add this subfolder to the path of your environment. On Windows, add%DART_SDK%\bin
instead to the front of the path (system environment) variable and click on OK. On Linux or OS X, addexport PATH=$PATH:$DART_SDK/bin
to your configuration file. - Reset your environment configuration file or reboot your machine afterwards for the changes to take effect.
How it works...
Setting the DART_SDK
environment variable, for example, enables plugins such as dart-maven to search for the Dart SDK (dart-maven is a plugin that provides integration for Google Dart into a maven-build process). If the OS of your machine knows the path where the Dart tools reside, you can start any of them (such as the Dart VM or dartanalyzer) anywhere in a terminal or command-line session.
Test the environment variable by typing dart
in a terminal and press Enter. You should see the following help text:
Usage: dart [<vm-flags>] <dart-script-file> [<dart-options>]
Executes the Dart script passed as <dart-script-file>
- Application Development with Qt Creator(Second Edition)
- 電子政務效益的經濟分析與評價
- 物聯網信息安全
- 局域網組建、管理與維護項目教程(Windows Server 2003)
- Yii Application Development Cookbook(Second Edition)
- Learning Swift(Second Edition)
- 通信十年:擁抱互聯網
- 網管第一課:網絡操作系統與配置管理
- 從實踐中學習手機抓包與數據分析
- 異構蜂窩網絡關鍵理論與技術
- 設備監控技術詳解
- 移動互聯網新思維
- 數字王國里的虛擬人:技術、商業與法律解讀
- 物聯網與智慧廣電
- 互聯網戰略變革與未來