How to downgrade dart version

How to Downgrade Dart Version

To downgrade your Dart version, you will need to follow these steps:

  1. Uninstall the current Dart version:
dart --version

Make note of the current version installed and then uninstall it using the command:

sudo apt-get purge dart-sdk

Note: The above command is for Linux-based systems. If you are using a different operating system, refer to the official Dart documentation for uninstallation instructions.

  1. Download the desired older version of Dart:

Go to the Dart SDK Archive page on GitHub (https://github.com/dart-lang/sdk/archive/) and find the version you want to install. Click on the version to open its page.

On the version’s page, click on “Clone or download” and then “Download ZIP” to download the SDK.

  1. Extract the downloaded ZIP file:

Extract the downloaded ZIP file to a location of your choice.

  1. Set the new Dart version:

Open your terminal and navigate to the extracted SDK folder. Use the command:

export DART_SDK=path/to/dart-sdk-folder

Note: Replace “path/to/dart-sdk-folder” with the actual path to the extracted SDK folder.

  1. Verify the version:

Use the command dart --version to verify that the new Dart version is successfully installed.

Congratulations! You have downgraded your Dart version.

Here’s an example to help you understand better:

Let’s say you currently have Dart version 2.8.4 installed, but you want to downgrade to version 2.7.2.

1. Uninstall the current version using sudo apt-get purge dart-sdk.

2. Download the Dart SDK version 2.7.2 from the Dart SDK Archive.

3. Extract the downloaded ZIP file to a location, let’s say “/path/to/dart-sdk”.

4. Set the new Dart version by running export DART_SDK=/path/to/dart-sdk in the terminal.

5. Verify the version with dart --version. You should see “Dart 2.7.2” as the output, indicating that you have downgraded successfully.

Leave a comment