Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dart version is 2.2.0 but I get an error requiring version >=2.2.0

Tags:

flutter

dart

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?

like image 908
Lee Avatar asked Mar 19 '19 18:03

Lee


People also ask

What is the latest version of dart?

Dart 2.10 was released in October 2020 with a dart command-line tool and a plan to support null safety in its forthcoming release. In version 2.12, the Dart community announced Dart null safety and other incremental improvements.

How do I get the dart SDK version?

Open Android Studio and click on Configure. Then, select Plugins. From the resulting screen, click on Flutter and click on Install. Click on Accept and then Yes to install the Dart plugin.

What version of dart does flutter use?

How does Flutter run my code on Android? The engine's C and C++ code are compiled with Android's NDK. The Dart code (both the SDK's and yours) are ahead-of-time (AOT) compiled into native, ARM, and x86 libraries.


1 Answers

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
like image 146
Günter Zöchbauer Avatar answered Oct 20 '22 16:10

Günter Zöchbauer