tutorial instalasi dart dari kelompok 9
3 min read
5 months ago
Published on Mar 11, 2025
This response is partially generated with the help of AI. It may contain inaccuracies.
Table of Contents
Introduction
This tutorial provides a step-by-step guide to installing Dart, a programming language optimized for building mobile, desktop, and web applications. Whether you're a beginner or an experienced developer, following these steps will help you set up Dart on your system effectively.
Step 1: Download Dart SDK
- Visit the official Dart website at dart.dev.
- Choose the appropriate installation method based on your operating system:
- Windows: Download the Dart SDK installer.
- macOS: You can install Dart using Homebrew with the command:
brew tap dart-lang/dart brew install dart
- Linux: Follow the instructions for your specific distribution. For example, on Ubuntu, you can use:
sudo apt update -y sudo apt install apt-transport-https sudo sh -c 'wget -qO- https://dl-ssl.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' sudo apt update -y sudo apt install dart
Step 2: Set Up Your Environment
-
Windows:
- After installation, add Dart to your system PATH:
- Right-click on 'This PC' and select 'Properties'.
- Click on 'Advanced system settings' and then 'Environment Variables'.
- Under 'System variables', find
Path
and click 'Edit'. - Add the Dart SDK path (usually
C:\dart\dart-sdk\bin
).
- After installation, add Dart to your system PATH:
-
macOS and Linux:
- You may need to configure your terminal profile to include Dart in your PATH. Add the following line to your
.bashrc
or.zshrc
file:export PATH="$PATH:/usr/lib/dart/bin"
- Refresh your terminal by running:
orsource ~/.bashrc
source ~/.zshrc
- You may need to configure your terminal profile to include Dart in your PATH. Add the following line to your
Step 3: Verify the Installation
- Open a command prompt or terminal window.
- Type the following command to check if Dart is installed correctly:
dart --version
- You should see the version number of Dart displayed. If you encounter an error, revisit the previous steps to ensure the installation and PATH configuration were done correctly.
Step 4: Install Dart Packages
- To manage packages in Dart, you will use the
pub
tool. - Create a new Dart project by running:
dart create my_project
- Navigate to your project directory:
cd my_project
- To add packages, modify the
pubspec.yaml
file in your project and include the desired dependencies. For example:dependencies: http: ^0.13.3
- Install the packages by running:
dart pub get
Conclusion
You've successfully installed Dart on your system and set up your environment for development. You can now start building applications using Dart. As a next step, consider exploring Dart's features or starting a sample project to familiarize yourself with the language. Happy coding!