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!
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
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
Related
I'm getting this issue with flutter pub get, tried to update the dart sdk, restart the pc to add the Dart sdk location back to the environment variables, delete the .git folder.
Running "flutter pub get" in calculator...
The current Dart SDK version is 2.13.4.
Because calculator depends on webview_flutter >=2.0.14 which requires SDK version >=2.14.0 <3.0.0, version solving failed.
pub get failed (1; Because calculator depends on webview_flutter >=2.0.14 which requires SDK version >=2.14.0 <3.0.0, version solving failed.)
exit code 1
Flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.2.3, on Microsoft Windows [version 10.0.19043.1288], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[√] Chrome - develop for the web
[√] Android Studio (version 4.0)
[√] VS Code (version 1.61.2)
[√] Connected device (3 available)
Dart Version:
Dart SDK version: 2.14.4 (stable) (Wed Oct 13 11:11:32 2021 +0200) on "windows_x64"
Change version of webview_flutter in pubspec.yaml to
webview_flutter: any
When you say you tried updating the Dart SDK, did you update your pubspec.yaml as well?
environment:
sdk: ">=2.14.0 <3.0.0"
Try deleting pubspec.lock and try again
try
flutter upgrade
it worked for me.
I solved the problem after updating Dart Sdk and restarting the pc.
Even after these two steps I still got the same error, so I put any in the package value in pubspec.yaml and before running flutter pub get, I turned off my antivirus.
just put your dependency without version
dependencies:
flutter:
sdk: flutter
file_picker: #put your conflicting dependency as without version
I am trying to migrate my Flutter/Dart project to use null safety. I have updated all of my dependencies and changed the sdk to use ">=2.12.0 <3.0.0". However, when I try to use the migration tool I get the following error:
When I look at my flutter and dart versions everything seems fine. I may be looking at it wrong, but below is the output from flutter doctor and brew info dart:
% flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.0.6, on macOS 11.4 20F71 darwin-x64, locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --
android-licenses
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.0)
[✓] VS Code (version 1.57.0)
[✓] Connected device (2 available)
! Doctor found issues in 1 category.
% brew info dart
dart-lang/dart/dart: stable 2.12.4, HEAD
The Dart SDK
https://dart.dev
Conflicts with:
dart-beta (because dart-beta ships the same binaries)
/usr/local/Cellar/dart/2.9.3 (509 files, 523.7MB) *
Built from source on 2020-09-14 at 16:52:16
From: https://github.com/dart-lang/homebrew-dart/blob/HEAD/dart.rb
==> Options
--HEAD
Install HEAD version
==> Caveats
Please note the path to the Dart SDK:
/usr/local/opt/dart/libexec
I'm suspecting that maybe I don't have the latest dart sdk like I believe I do. If that's the case then how do I upgrade without breaking anything?
UPDATE:
It appears I am using the latest version of dart. Going into the settings in Android Studio I can see it is pointing at the dart sdk that ships with flutter:
Have you run "flutter upgrade" in your terminal?
After upgrading Flutter and Dart to the latest versions I also updated the dependencies of my app. Now, when I run flutter pub get I get the following error:
Because no versions of permission_handler match >5.1.0+2 <6.0.0 and permission_handler 5.1.0+2 depends on permission_handler_platform_interface ^2.0.2, permission_handler ^5.1.0+2 requires permission_handler_platform_interface ^2.0.2.
And because no versions of permission_handler_platform_interface match >2.0.2 <3.0.0 and permission_handler_platform_interface 2.0.2 depends on plugin_platform_interface ^1.0.2, permission_handler ^5.1.0+2 requires plugin_platform_interface ^1.0.2.
And because geolocator >=7.0.0 depends on geolocator_platform_interface ^2.0.0 which depends on plugin_platform_interface ^2.0.0, permission_handler ^5.1.0+2 is incompatible with geolocator >=7.0.0.
So, because MyApp depends on both geolocator ^7.0.1 and permission_handler ^5.1.0+2, version solving failed.
Running "flutter pub get" in flutter_app...
pub get failed (1; So, because MyApp depends on both geolocator ^7.0.1 and permission_handler ^5.1.0+2, version solving failed.)
I do not quite understand where the error is and what I can do to fix it. If there is any information missing, I will add it as soon as I can. Does anyone have an idea what I need to change in the dependencies?
Here is my flutter doctor:
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.0.1, on Microsoft Windows [Version 10.0.19042.804], locale de-DE)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[√] Chrome - develop for the web
[√] Android Studio (version 4.1.0)
[√] IntelliJ IDEA Ultimate Edition (version 2020.3)
[√] Connected device (3 available)
• No issues found!
That’s because this package doesn’t support null safety yet. I think you should rather create an issue on their GitHub repository instead of asking the question here.
Was in the process of integration and this error kept occuring tried multiple answers such as using flutter clean or changing the CompiledSdk to no avail. i am debugging on Pixel 2 XL Api level 27.
Here is the output of flutter run -v : https://pastebin.com/UdaFSFvP
Here is the pubspec.yaml : https://pastebin.com/UdaFSFvP
Here is the output of flutter doctor : https://pastebin.com/4DThja3W
[√] Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [Version 10.0.18362.778], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[√] Android Studio (version 3.5)
[!] IntelliJ IDEA Community Edition (version 2019.1)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[!] Connected device
! No devices available
! Doctor found issues in 2 categories.
So i solved this.
If you encounter this error try the following.
1.flutter clean
2.delete pubspec.lock
3.flutter pub get
4.check dependencies versions as some might be incompatible with your target Sdk (this was my error)
I'm trying to install image-size-getter on my flutter desktop project.
When i add this to my package's pubspec.yaml:
dependencies:
[...]
image_size_getter: ^0.1.0
i get this error:
Because every version of flutter_test from sdk depends on collection
1.14.11 and every version of image_size_getter depends on collection ^1.14.12, flutter_test from sdk is incompatible with
image_size_getter. So, because example_flutter depends on both
image_size_getter ^0.1.0 and flutter_test any from sdk, version
solving failed.
I tried to solve that issue by ovveriding dependencies as i found here and here (i must be on the futter master channel):
dependency_overrides:
flutter_test: ^1.14.12
But now it seems that flutter_test package is not available:
Because example_flutter depends on flutter_test any which doesn't
exist (could not find package flutter_test at
https://pub.dartlang.org), version solving failed. pub get failed
(server unavailable) -- attempting retry 1 in 1 second... Because
example_flutter depends on flutter_test any which doesn't exist (could
not find package flutter_test at https://pub.dartlang.org), version
solving failed. pub get failed (server unavailable) -- attempting
retry 2 in 2 seconds... Because example_flutter depends on
flutter_test any which doesn't exist (could not find package
flutter_test at https://pub.dartlang.org), version solving failed. pub
get failed (server unavailable) -- attempting retry 3 in 4 seconds...
[..]
I upgraded to last master channel version, this is my flutter doctor output:
PS C:\flutter\200229_flutter-desktop-embedding-master\example> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel master, v1.15.4-pre.239, on Microsoft Windows [Versione 10.0.18362.657], locale it-IT)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.4.3)
[√] Android Studio (version 3.0)
[√] IntelliJ IDEA Ultimate Edition (version 2017.2)
[√] VS Code, 64-bit edition (version 1.42.1)
[√] Connected device (1 available)
No issues found!
How i can i solve my issue?
flutter_test is not a regular package that you can override the version for - it is a part of the Flutter SDK.
What you can do however is override the version of collection such that both flutter_test and image_size_getter use the same version and no longer conflict.
Try this:
dependency_overrides:
collection: ^1.14.12
Update your latest collection plugin
dependencies:
collection: ^1.14.13