Should I worry about Flutter and Dart version being different?

Viewed 1628

Flutter uses the dart-lang SDK (and executable). So when I want to see what version I'm using, I run this and get the following:

Flutter

flutter --version

Output

Flutter 1.23.0-18.1.pre • channel beta • https://github.com/flutter/flutter.git
Framework • revision 198df796aa (7 days ago) • 2020-10-15 12:04:33 -0700
Engine • revision 1d12d82d9c
Tools • Dart 2.11.0 (build 2.11.0-213.1.beta)

Version: 2.11.0

Dart

But when I check my machine's dart version. I see something different..

dart --version

Output

Dart SDK version: 2.10.2 (stable) (Tue Oct 13 15:50:27 2020 +0200) on "macos_x64"

Version: 2.10.2


How can I make sure I'm always using the same dart-sdk and executable between the dart tool and flutter? What is managing the two tools? Should I worry about Flutter and Dart version being different (edit)?

3 Answers

You shouldn't worry, but more importantly, the 2 versions are built for each other.

For example, when you install an old version of Flutter, the version of Dart which will be used will not be the latest version of Dart, but the one that was released around the same time as the Flutter you are using.

I learnt this in my question/ GitHub issue, Choose specific Dart version used by Flutter .

Flutter is tightly coupled to Dart, so you can't mix and match versions. If you really wanted to run a specific version of Dart that it wasn't built with you would need to fork the framework and the engine and custom-build your own combination, which would almost certainly include lots of changes to make them compatible. Stuart Morgan, Flutter team

Flutter version and dart version don't have to be the same. You can see from here, the latest Dart SDK version is 2.10.0. But there are lots of newer versions in Flutter as in here. Dart has a version note in their documentation:

As of Flutter 1.21, the Flutter SDK includes the full Dart SDK. This site’s documentation and examples use version 2.10.0 of the Dart SDK.

If you have installed the dart sdk separately before, you could just delete it, and then the dart sdk included in the Flutter will be used automatically.

find the installation folder which dart

if it is not in the flutter SDK folder

then just rm -r the folder

Related