I'm trying to add build_runner: ^1.10.2
to dev_dependencies
in the pubspec.yaml
file, but I am getting the following error:
The current Dart SDK version is 2.9.0.
Because project_name depends on build_runner >=1.10.2 which requires SDK version >=2.10.0-0.0 <3.0.0, version solving failed.
pub get failed (1; Because project_name depends on build_runner >=1.10.2 which requires SDK version >=2.10.0-0.0 <3.0.0, version solving failed.)
I checked the dart website and the latest version of Dart SDK is 2.9.0 while 2.10 is still in dev.
Here's my flutter doctor
output:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 1.20.1, on Microsoft Windows [Version 10.0.18362.959], locale en-IN)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[√] Android Studio (version 4.0)
[√] VS Code, 64-bit edition (version 1.39.2)
[√] Connected device (1 available)
• No issues found!
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.
As of September 28, 2020 the latest version of Flutter on stable
channel no longer has this issue.
Use these commands to upgrade.
flutter channel stable
flutter upgrade
This is an issue with the latest releases of dart, analyzer, and flutter creating conflicts with each other, which you can read more about at this Github issue. There likely is no real issue with your configuration.
A temporary solution that I've seen is to use a dependency override of the analyzer:
dev_dependencies:
build_runner: ^1.10.0
dependency_overrides:
analyzer: 0.39.14
I encountered this problem after doing some cleaning up of my directories and having downloaded/installed the latest flutter. Bam. Then I realised that version of flutter sits by default on channel stable. After switching to master, it solved my problem, i.e.:
flutter channel master
flutter upgrade
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With