Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

dart

How to check dart version on macOS

Faraz Karim
widget

The Dart software development kit contains tools that allow you to create servers and web apps. The Flutter SDK has begun including the complete Dart SDK as of version 1.21. So, if you have Flutter installed, you already have the Dart SDK installed.

The easiest, most convenient method for handling the Dart SDK is to use the brew package manager. Alternative methods include downloading the Dart SDK zip file, installing Dart from a docker image, or building it from the source.

You can visit the official Dart website for further details on these alternate methods.

We will be focusing on using the most simple and common method in this article.

The homebrew package manager

The brew package manager handles all the dependencies and sets up the Dart SDK environment, which makes our lives easier.

To install brew, open up your mac terminal and run the following command:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Dart installation

In case you do not have any version of Dart on your system, it is easy to install one through the homebrew package manager; just run the following two commands:

brew tap dart-lang/dart
brew install dart

Now you can run the

brew info dart

command to verify your installation.

Checking Dart version using homebrew

With homebrew package manager installed, you can easily check the installation status of Dart by running the following command on your mac terminal:

brew info dart

Switching Dart versions

Another functionality of homebrew is that it allows the user to switch between different versions available on a system. This can come in handy if you plan to check the behavior of your application on multiple systems (new and old).

To switch between versions of Dart in your system, you can run the following command:

brew switch dart <dart version>

In the above command, you need to replace the <dart version> with the actual version number of Dart that you want to switch to (assuming it is present on your system).

Updating your dart version

Updating the Dart version installed on your macOS system is also a quick and easy process. You just need to run the following command in your mac terminal, and your Dart version will be updated to the latest stable version available.

brew upgrade dart

RELATED TAGS

dart

CONTRIBUTOR

Faraz Karim
Copyright ©2022 Educative, Inc. All rights reserved
RELATED COURSES

View all Courses

Keep Exploring