After checking the dart overview, if you’re interested in learning dart then you’re at the right place. we will discuss about all the basic and advanced concepts of dart one by one.
Now you will be thinking about the prerequisites for learning dart language. And only one prerequisite required for learning dart throughout this journey is your willingness and interest in learning dart coding.
To practice your coding skills while learning different concepts, you will require tools or IDE to test your dart code.
So, we can run our dart code in following ways in different environments.
Run In DartPad
Starting from official editors, DartPad is the online editor for testing your dart programs. To test your programs on DartPad visit the official website
The DartPad executes the dart code online and displays both HTML as well as console output.
Run Dart Code with command-line using Dart VM
To run any dart program in your machine we need the support of Dart Virtual Machine (Dart VM) which contains the components for executing dart codes.
We can get Dart VM by Installing the Dart SDK(collection of dart libraries and components run our dart code). To download the current stable version of Dart SDK, visit the official website
Install the Dart SDK and then setup the PATH environment variable to following path :
<your-dart-sdk-path>\bin
Generally, SDK path in windows would be like (C:\Program Files\Dart\dart-sdk\bin).
Now, to verify the installation of the Dart VM write the below command in terminal :
dart
If installation is successful then it will show the dart runtime and details. Otherwise check out the above steps for installing dart SDK in your machine.
To run any program using command line, Create a file with .dart extension like hello.dart :
hello.dart file
void main() {
print(‘Hello, World!’);
}
Now to run it in command line, Go to the dart file path in terminal and then write the code below,
dart hello.dart
Output :
Hello, World!
Run dart code with IDEs(like Intellij, WebStrom, Android Studio)
Now comes the IDEs which support the Dart as plugin to test our skills. So, there are numerous IDEs which provides support for Dart Plugin. Some of the Famous IDEs are :
- Intellij IDEA
- WebStorm
- Android Studio
- XCode
Differnt IDEs also requires Installation of Dart SDK in your Machine. So, install Dart SDK as instructed above.
After Installing the Dart SDK, you have to Install IDE of your choice. So, to Integrate Dart with Intellij IDEA Software Download any one IDE of your choice from below links.
Intellij IDEA visit official website
Webstorm visit official website
Android studio visit official website
XCode IDEA visit official website
Now, Install your IDE. Then Install dart plugin in your choice of IDE. Then Click on create a project and select Dart option and then you have to specify the path of your Dart SDK which you have downloaded. Then you will be able to create a project and run dart code as well.
So, in one of the above way you can setup your dart programming environment to test your coding skills while learning the dart language.
If you face any difficulty installing Dart SDK or anything else then comment below and we will help you to sort out your issue.
My personal suggestion to test your dart code is Dartpad or Intellij IDEA. As I really feel comfortable working with these two components.
Feel free to ask your questions in the comment section. Keep reading and commenting your suggestions to make toastguyz a better site to learn different programming languages.