34

After switched to branch 'stable' flutter channel

The following is the build issue.

Error: The specified language version is too high. The highest supported language version is 2.8.

output: ../../third_party/dart/third_party/pkg/collection/lib/src/utils.dart:1:1: Error: The specified language version is too high. The highest supported language version is 2.8.
// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
^
../../third_party/dart/third_party/pkg/collection/lib/src/wrappers.dart:1:1: Error: The specified language version is too high. The highest supported language version is 2.8.
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
^
../../third_party/dart/third_party/pkg/collection/lib/src/functions.dart:1:1: Error: The specified language version is too high. The highest supported language version is 2.8.
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
^
J L
  • 647
  • 1
  • 7
  • 15
  • 1
    Post error messages and your question directly into the body. Additionally, share your `pubspec.yaml`. – Christopher Moore Jul 30 '20 at 22:14
  • I added the pubspec.yaml as an image – J L Aug 04 '20 at 10:39
  • Post error messages and your question directly into the body of your question using the formatting tools provided and share the output of `flutter channel`. – Christopher Moore Aug 04 '20 at 13:28
  • Check this. https://github.com/flutter/flutter/issues/61847 – wqyfavor Sep 08 '20 at 05:34
  • 2
    I was facing the same problem. Simply use 'flutter clean' and then the 'flutter run' command, and all the problems are resolved automatically. – Ali Haider Sep 08 '20 at 11:47
  • please do try "flutter clean" and then "flutter run" before you do any unnessasary steps... It worked for me ... – Aravind Siruvuru Sep 25 '20 at 04:23
  • 1
    I've voted to reopen this - while it appears to be a specific configuration issue, this error can come about from a more general situation of Flutter channel being messed up. If I could add an answer it would be to do the following (which just fixed this for me) : 1. `flutter --version` # check version, 2. `flutter channel stable`, 3. `flutter upgrade` – kris Oct 29 '20 at 01:50

5 Answers5

28

Why?

This happens, because the your specified language version is higher than the one declared in the .dart_tool directory (specifically in the package_config.json file).

Solution

You can either delete the folder manually or let Flutter tools do it for you. Run flutter clean from the terminal or, if using Android Studio, go to Tools -> Flutter -> Flutter Clean.

Michal Karbownik
  • 1,138
  • 14
  • 28
1

Cause

One of your packages in pubspec.yaml is requiring dart version up that you have installed. For example, I face this issue withe analyzer package. In my pubspec

analyzer: ˆ3.3.1

So I ve run

flutter version
Answer
Tools • Dart 2.13.3

But as you can see here version 3.3.1 require Dart Tools 2.14

enter image description here

Solution

Discover which package version in incompatible with your dart

Frederico Fiuza
  • 127
  • 1
  • 1
1

In my case, I had Flutter and Dart installed seperately

  1. Dart(Flutter) - v2.19.2
  2. Dart - v2.17.6

When I run dart command, it uses 2.Dart, which is outdated I removed by brew uninstall dart, and after restarting terminal, it uses flutter dart instead of dart which is latest version

Guvanch
  • 838
  • 7
  • 10
0

Run flutter clean and then flutter --version command from the terminal:

terminal execution of aforementioned commands

Then, check the flutter version in pubspec.yml (here it is 1.22.5) and change the version to match the one from the terminal.

enter image description here

Michal Karbownik
  • 1,138
  • 14
  • 28
SYED FAISAL
  • 495
  • 5
  • 8
  • Thanks for the answer, solved my issue by following these steps. Should be marked as correct answer. – akshitmahajan Dec 19 '20 at 21:04
  • 2
    I realize this is an older post, but I'm confused about the comparison of the version of flutter to the version in the pubspec.yaml. From [the Dart Docs](https://dart.dev/tools/pub/pubspec#version) indicate the version in the pubspec is for your package and not the version of flutter. Am I mistaken? – Paul Stoner Apr 15 '21 at 16:39
-2

I had the same error yesterday and I fixed it.

This error came when you switch the version of flutter from 1.17.5 (stable channel) to 1.20.? (dev channel).

To fix it, just create a new project using the last version installed on your PC and copy & paste all the files.

The problem comes from the pubspec.lock file because of the versions.

So in conclusion, if you changed the version of Flutter, just create another project and copy the necessary files.

Michal Karbownik
  • 1,138
  • 14
  • 28
  • Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel stable, v1.12.13+hotfix.5, on Microsoft Windows [Version 10.0.18363.959], locale en-US) [√] Android toolchain - develop for Android devices (Android SDK version 29.0.2) [√] Android Studio (version 3.6) [√] VS Code (version 1.47.3) – J L Aug 04 '20 at 19:16
  • [√] Flutter (Channel stable, v1.17.5, on Microsoft Windows [Version 10.0.18363.959], locale en-US) [√] Android toolchain - develop for Android devices (Android SDK version 30.0.1) [√] Android Studio (version 4.0) [√] VS Code (version 1.47.3) [√] Connected device (1 available) – J L Aug 06 '20 at 10:15
  • I updated the version - same error message accross the flutter project apps.ERROR: Could not find method android() for arguments [build_1rg1v59oeriv4kmihpnqlgtzy$_run_closure1$_closure3$_closure4@d963f4d] on project ':@react-native-community_async-storage' of type org.gradle.api.Project. – J L Aug 06 '20 at 10:18
  • firstly, try create a new project(simple flutter project) , run it and see if there is an error or it works. post comment when its done – Nouredine LAMAMRA Aug 08 '20 at 12:49
  • Hi, the issue seems to be in Android Studio where I cannot find the issue. I connected the emulator to my VS codes and it works. thanks @Noreddine Doudine Lam for your help. – J L Aug 09 '20 at 00:07
  • 31
    I had same issue. juse goto Tools, flutter >> flutter clean, then run the project. It should work isa. – waleed.makarem Aug 13 '20 at 04:11
  • 2
    @waleed.makarem thanks, your solution worked. You should post it as the answer. – Gabu Aug 28 '20 at 17:16