If you are reaching this page first, you might want to have a look at the DART installation tutorial which explains the installation steps for the DART Compiler on an Linux based system like Ubuntu or Mac using the package manager.
This post describes how to install the Intellij IDEA plugin for Dart on any Linux based computer like Ubuntu, Mint or Mac OS.
Now lets get started, if you are like me you love your IDE’s aka Integrated Development Environments for programming. For me they should be easy to code within and debugging should be a snap. Intellij IDEA IDE is hands down one of the best available IDE in the market, there is a Community edition as well as a Pro edition (pay-to-use).
You may have used PyCharm IDE earlier which is also made by the same company and works quite well for python programming. It’s been a while I’ve looked for alternative IDE’s for DART programming and havn’t been able find one easily.
But wait there is hope ! Intellij IDEA IDE has a package for DART which provides you with the ability to program and debug in Intellij IDEA using DART. You can use the community version of Intellij IDEA (Free) to install the Dart package and then fire off your dart programs just like any other IDE.
Lets get started with the setup. Download and install Intellij IDEA Community version
Install the DART Plugin for Intellj IDEA IDE
Download the Dart Plugin for Intellij IDEA. Once you open the link you will see a list of compatible plugin versions for your installed version. Choose the correct version of the plugin if you already had Intellij IDEA installed earlier.
Download the latest compatible dart plug-in zip file from the website and extract the contents of the zip file into a folder with the name Dart (you can use any name you wish).
I’m using the Linux version of Intellij IDEA on an Ubuntu 16.04 Desktop system and have put the contents of the plugin zip into the “plugins” folder within the IntelliJ IDEA. If you have a Mac or Windows you will need to reach their respective installation locations via the file manager. The install location is usually the location of the Intellij IDEA and within it the plugins directory.
Ensure, that the plugin folder Dart contains the folder “Lib” inside it. Great, the plugin is now installed. Next lets configure the DART plugin inside Intellij IDEA Interface. Start the Intellij IDE from the start menu in your OS. For Ubuntu systems navigate to the location of the IDE via a terminal session.
Run the IDE with the following command : ./idea.sh
Also in order to find the install location of the DART compiler (not plugin) we can issue a command as follows :
If the DART compiler is installed in your system, you should see something like this :
In our case /usr/bin/dart is the install location. Copy this location path and head over to the Intellij IDEA Interface. From “File” menu at the top click on “Settings”.
In the above window you can see under “Language & Frameworks” there is a section for Dart. If not already set, click on the check-box for “Enable Dart support for the project” and enter the path of the DART compiler which you copied in the earlier step inside Dart SDK Path field. Rest of the options can remain as default.
On Linux and Mac systems, you will also need to setup the terminal environment variables to allow any programs to find the DART compiler location running from the command line.
Head over to the terminal and enter the following command :
At the end of the the above file add the following lines:
You can find dart packages for web, mobile and server programming environments. For the web the AngularDart version is a good choice for development.
Thats it ! Now your IDE is setup to run DART programs. In the next post lets try a small “hello world” program to check if its working.