Here is an alternative to what Gunter suggested.
Install Dart 2 without uninstalling Dart 1
> brew upgrade dart --devel --force
If you don't have Dart 1 installed, then simply use:
> brew install dart --devel
Switching between Dart 1 and Dart 2
To switch to Dart 1, use the switch
command followed by the version of Dart 1 that you have installed. For example:
> brew switch dart 1.24.3
Switching back to Dart 2 is similar, for example:
> brew switch dart 2.0.0-dev.64.1
Listing Dart versions
If you aren't sure which versions of dart you have installed, then run brew info
:
> brew info dart
dart-lang/dart/dart: stable 1.24.3, devel 2.0.0-dev.64.1
The Dart SDK
https://www.dartlang.org/
***[Your locally installed versions of dart will be listed here]***
Using dart@2
and dart@1
formulas
Until Dart 2 final is released, you can use the brew formulas dart@1
and dart@2
as illustrated below.
WARNING: these formulas are keg-only, which means installed binaries are not symlinked in the usual way. Follow the instructions in the command output to set your PATH appropriately.
> brew install dart@2
==> Installing dart@2 from dart-lang/dart
==> Downloading https://storage.googleapis.com/dart-archive/channels/dev/release/2.0.0-dev.64.1/sdk/dartsdk-macos-x64-release.zip
######################################################################## 100.0%
==> Caveats
Note that this is a prerelease version of Dart.
Please note the path to the Dart SDK:
/<your-brew-root-path>/opt/dart@2/libexec
This formula is keg-only, which means it was not symlinked into /...,
because this is an alternate version of another formula.
If you need to have this software first in your PATH run:
echo 'export PATH="/<your-brew-root-path>/opt/dart@2/bin:$PATH"' >> ~/.bash_profile