Reputation: 1465
I have the latest version of Flutter and I'm trying to run the official Flutter gallery app. When I do dart --version
I get
Dart VM version: 2.2.0 (Tue Feb 26 15:04:32 2019 +0100) on "macos_x64"
However, when I try to get the packages:
[flutter_gallery] flutter packages get
Running "flutter packages get" in flutter_gallery...
The current Dart SDK version is 2.1.2-dev.0.0.flutter-0a7dcf17eb.
Because flutter_gallery requires SDK version >=2.2.0 <3.0.0, version solving failed.
pub get failed (1)
exit code 1
What's interesting is when I run flutter upgrade
it lists an older version of Dart (Tools).
Upgrading Flutter from /Users/leejohnson/dev/flutter...
From https://github.com/flutter/flutter
a1bee54fd..59ce7d6bf dev -> origin/dev
55a2ee588..f8f2b043e master -> origin/master
* [new tag] v1.3.13 -> v1.3.13
Already up to date.
Upgrading engine...
Already up-to-date.
Flutter 1.2.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 8661d8aecd (5 weeks ago) • 2019-02-14 19:19:53 -0800
Engine • revision 3757390fa4
Tools • Dart 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)
If I understand this error correctly, Flutter is not using the latest version of Dart yet the official Flutter example app requires it. How do I fix this?
Upvotes: 8
Views: 5173
Reputation: 7424
For anyone else stuck (The other channels were broken), what I found was switching to stable then switching versions within stable fixed it for me. You can do this by doing the following:
flutter versions
flutter versions 1.5.5
(Or some other version)
Upvotes: 0
Reputation:
Flutter has its own dart-sdk in flutter/bin/cache/
. So when you do dart --version
, its probably another dart sdk in your system.
Upvotes: 3
Reputation: 658057
The output of dart --version
is completely irrelevant for Flutter. What you need to check is flutter doctor -v
or flutter --version
. In your case it shows Tools • Dart 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)
You probably need to switch to another channel until the next stable channel update
flutter channel dev
or
flutter channel master
Upvotes: 9