dart plugin for asdf version manager
curl
unzip
or7z
to decompress the downloaded zip
asdf plugin add dart https://github.com/patoconnor43/asdf-dart.git
Check the asdf instructions for how to install and set your Dart version.
The default behavior for this plugin used to include dev
and beta
versions
when listing all the versions. This got really noisy and interfered with
asdf install dart latest
installing the latest stable version. If you want
to re-enable these channels you can set these environment variables.
ASDF_DART_ENABLE_BETA=true
ASDF_DART_ENABLE_DEV=true
These environment variables will ensure only the base versions are included.
Dart plugins for IntelliJ, VS Code, etc., typically need you to provide a path where the Dart SDK is installed.
Using asdf installs Dart in a consistent place, but may be confusing if you don't know where that is.
The install location can be found by running asdf where dart
, which should be $HOME/.asdf/installs/dart/VERSION
Dart Code can be configured to use the active asdf version using the following settings.json
configuration
{
"dart.sdkPaths": ["~/.asdf/installs/dart/"],
"dart.getDartSdkCommand": {
"executable": "asdf",
"args": ["where", "dart"]
},
}
tools/dart_version_watcher.sh
that will create a file watcher for any time your global versions change and then update a symlink that points
to the current version. This means you can point your IDE at ${HOME}/.asdf_dart_sdk
and anytime you change versions, this file will point to
the most recent version. If you're interested check the install instructions inside the tools/
directory.
dart2js
dart2native
dart
dartanalyzer
dartaotruntime
dartdevc
dartdevc
dartdoc
dartfmt
pub
and many more...
content_shell
(Dart 1 exclusive)dartium
(Dart 1 exclusive)
If you're using this plugin it's probably because you're using multiple
versions of the Dart SDK. This means you also want to be able to use different
versions of the language server. This is easy enough in Vim/Neovim by getting
the language server path by running asdf where dart
. In VSCode, you'll
probably want to use the dart.sdkPaths
setting. This will allow you to add a
path where your SDKs are located and then switch them on the fly. An example
value for this setting is <an absolute path to your asdf folder>/installs/dart
. If you hover over the Dart Syntax Switcher in the
bottom right of the editor you should see a way to change which SDK you want to
use.
IMPORTANT NOTE: If there are versions of the SDK that are installed, but don't show up in the menu, you should be able to uninstall and re-install those versions. This is due to a path change that was necessary to facilitate this feature.
Shoutout to @Rapougnac for bringing this up!
Feel free to create an issue or pull request if you find a bug.
MIT License