Issue
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!
Solution
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
Answered By – Christopher Moore
Answer Checked By – Marie Seifert (FlutterFixes Admin)