1

I installed Flutter for Mac OS which already includes Dart. However, when I try to run a simple hello world Dart program from Terminal via dart hello.dart I get the typical command not found error. I do not know where Flutter installs the Dart SDK for my .bash_profile. What is the proper way to fix this?

4 Answers 4

5

Flutter indeed comes with a dart sdk. But it's not made to be used outside. It's specifically edited for flutter (some stuff removed, other added).

If you want to use dart on it's own, you still need to install dart sdk.

Sign up to request clarification or add additional context in comments.

1 Comment

Indeed that appears to be the case. I installed the SKD and all is well now.
1

To run a Dart program from Mac OS Terminal, make sure you have Dart SDK installed on your macOS using command brew info dart . If not , then follow Dart SDK installation Dart install/setup on Mac/OSX

Comments

1

To your terminal config file (for example .zshrc) add

export PATH=$PATH:path-to-your-flutter-dir/flutter/bin/cache/dart-sdk/bin 

(change path-to-your-flutter-dir to real path)

close/open terminal

run

dart --version 

Comments

0

One option to use Dart outside Flutter setup: https://dart.dev/tutorials/server/get-started

ansd the secondoption in the web-browser: https://dartpad.dev/

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.