How to update dart sdk version

Updating Dart SDK Version

To update the Dart SDK version, you can follow the steps given below:

  1. Open a command-line interface or terminal on your system.
  2. Check the current version of the Dart SDK installed using the command dart --version.
  3. Visit the official Dart SDK website (https://dart.dev/) to find the latest stable version available.
  4. Download the appropriate SDK package for your operating system.
  5. Extract the contents of the downloaded package to a suitable location on your system.
  6. Update the environment variables to point to the new Dart SDK location:
    • On Windows:
      • Open the Start menu and search for “Environment Variables”.
      • Choose “Edit the system environment variables”.
      • In the System Properties window, click on the “Environment Variables” button.
      • In the “System variables” section, find the “Path” variable and click on “Edit”.
      • Add a new entry with the path to the Dart SDK folder you extracted.
      • Click “OK” on all windows to save the changes.
    • On macOS or Linux:
      • Open a terminal window.
      • Enter the command sudo nano /etc/paths and press enter.
      • Enter your password if prompted.
      • Add a new line at the end of the file with the path to the Dart SDK folder you extracted.
      • Press “Ctrl + X”, then “Y”, and finally “Enter” to save the changes.
  7. Close and reopen your command-line interface or terminal.
  8. Verify the new Dart SDK version using the command dart --version.

Example:

If you were previously using Dart SDK version 2.5.0 and want to update to version 2.9.0, you would download the SDK package for your operating system from the official Dart SDK website (https://dart.dev/). Let’s assume you extracted the contents of the package to the directory C:\dart-sdk on Windows or /usr/local/dart-sdk on macOS or Linux.

For updating environment variables on Windows, you would add the following entry to the “Path” variable:

C:\dart-sdk\bin

On macOS or Linux, you would add the following line to the /etc/paths file:

/usr/local/dart-sdk/bin

After closing and reopening your command-line interface or terminal, you can use the command dart --version to verify that the Dart SDK version has been successfully updated to 2.9.0.

Same cateogry post

Leave a comment