DEV Community

Laura Gyre
Laura Gyre

Posted on

Dart Tutorials on Exercism

I'm teaching myself Flutter, and while the tutorials I'm using (Udemy) explain the actual coding well enough, I've come close to giving up at several points while trying to get programs and other basic tools up and running.

Today I learned about the coding challenges at Exercism, in many languages including Dart (awesome)! I also spent a couple of hours attempting to actually run them on my computer, and was about to give up before I finally figured it out.

In case anybody else is in a similar boat, here's what I learned. FWIW, I have a mac, and this is pretty much all I know about this-not sure how much of this will translate to others.

  1. First of all, though, you need to have Dart installed on your computer in a way that Terminal can access. Having the extensions for Android Studio and/or IntelliJ is not the same thing. If you type "dart" into terminal and it has no idea what you're talking about, this is probably you. In order to install it, you probably also need Homebrew. Type "brew -v" to see if your computer knows anything about this.

Here are the instructions to install Homebrew: https://brew.sh/
Here are the instructions to install a Dart SDK: https://dart.dev/get-dart (What's an SDK? I have no idea–but I still know far more about how to do this than any comprehensive articles I could find, and I do know that my stuff is running now).

  1. Use this tutorial to install actual Exercism: https://exercism.io/cli-walkthrough

  2. Go to the language track you want to try and click on the "Hello World" module. Get the download link from the right column, copy and paste it into terminal. This will download the project to your computer and tell you what directory it's going into.

  3. Open IntelliJ, choose "open" and navigate to the "hello world" folder on your computer. Open the terminal window at the bottom of IntelliJ and type "pub get" to get any additional files (and check for other top of screen notices about importing things). Click on the dart file and complete the challenge.

  4. When you think you have it, type "pub run test" and your work will be checked. If it fails, you get some clues.

  5. When it passes, you can submit your solution by using "cd" to navigate to the folder that contains your file in terminal, then typing "exercism submit [yourfile].dart". There are a few more things to click, but they're pretty self-explanatory.

Top comments (3)

Collapse
 
93petter93 profile image
Petter

I got stuck at 4. Any suggestions on what i could do?

The following came up in terminal:
Petter@Petters-MBP hello-world % pub run test
Could not find a file named "pubspec.yaml" in "/Users/Petter/.pub-cache/hosted/pub.dartlang.org/_fe_analyzer_shared-4.0.0".

Collapse
 
dhruvgupta1001 profile image
Dhruv-gupta1001

I am getting same issuse.

Collapse
 
akhilksugathan profile image
akhilksugathan

Thank You Laura, It is really helpful