How to Install and Configure Dart for Cross‑Platform Development
This guide explains what Dart is, outlines its multi‑platform use cases, and provides step‑by‑step installation commands for Linux, macOS, and Windows, plus environment‑variable configuration, enabling developers to start building Dart‑based applications across devices.
What is Dart?
Dart is an object‑oriented, class‑based language developed by Google. It is statically typed but also supports dynamic typing, and is optimized for building user interfaces, asynchronous streams, and widget trees across multiple platforms.
Typical Use Cases
Mobile app development with Flutter
Web development compiled to JavaScript
Server‑side applications using dart:io or frameworks such as Aqueduct
Command‑line utilities (e.g., the Flutter CLI)
Installing Dart
Linux
Run the following commands in a terminal. The first block adds Google’s APT repository; the second block installs the SDK.
sudo apt-get update
sudo apt-get install apt-transport-https
sudo sh -c 'wget -qO- https://dl.google.com/linux/linux_signing_key.pub | apt-key add -'
sudo sh -c 'wget -qO- https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
# For faster access in China, replace the domain as shown below:
sudo sh -c 'wget -qO- https://storage.flutter-io.cn/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
sudo apt-get update
sudo apt-get install dartmacOS
If Homebrew is installed, add the Dart tap and install:
brew tap dart-lang/dart
brew install dartWindows
Using Chocolatey, install the SDK from an elevated command prompt: choco install dart-sdk Run the command prompt as administrator (e.g., press Windows+R, type cmd, then press Ctrl+Shift+Enter).
Verify the installation:
dart --versionConfiguring Environment Variables (Linux example)
Append Dart’s bin directory to the PATH variable, for example by adding the following line to ~/.profile and reloading the shell:
echo 'export PATH="$PATH:/usr/lib/dart/bin"' >> ~/.profileDunmao Tech Hub
Sharing selected technical articles synced from CSDN. Follow us on CSDN: Dunmao.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
