Closed rasitayaz closed 1 year ago
@rasitayaz what version of analyzer are you using? Are you getting a warning at the top of your build about an outdated analyzer?
It would also help to have a full stack trace and build log, this one doesn't provide the context necessary to diagnose.
Sorry for not including full stack trace, here it is:
I was able to get the warning about outdated analyzer after running flutter clean
and flutter pub get
.
Seems like I'm not using the latest version of analyzer: analyzer: ^4.7.0
When I try to upgrade analyzer to 6.3.0, I'm getting the following error:
Because every version of flutter_test from sdk depends on meta 1.9.1 and analyzer >=6.3.0 depends on meta ^1.11.0, flutter_test from sdk is incompatible with analyzer >=6.3.0.
So, because app depends on both analyzer ^6.3.0 and flutter_test from sdk, version solving failed.
You will need the latest analyzer to resolve this issue. Can you update your flutter version possibly? If not you can try using a dependency override to force the latest analyzer.
I'm already using the latest flutter version right now.
flutter upgrade
Flutter is already up to date on channel stable
Flutter 3.13.9 • channel stable • https://github.com/flutter/flutter.git
Framework • revision d211f42860 (3 weeks ago) • 2023-10-25 13:42:25 -0700
Engine • revision 0545f8705d
Tools • Dart 3.1.5 • DevTools 2.25.0
but somehow can't update the analyzer to the latest version for this project like I mentioned in my previous reply. how do I use a dependency override to force the latest analyzer?
but somehow can't update the analyzer to the latest version for this project like I mentioned in my previous reply. how do I use a dependency override to force the latest analyzer?
in your pubspec.yaml:
dependency_overrides:
analyzer: ^6.3.0
I'm already using the latest flutter version right now.
That is not good if it is pinned to a version of analyzer that doesn't support the language features that ship with that version.... 😱
in your pubspec.yaml:
dependency_overrides: analyzer: ^6.3.0
still getting the same error unfortunately:
Because analyzer >=6.3.0 depends on meta ^1.11.0 and every version of flutter_test from sdk depends on meta 1.9.1, analyzer >=6.3.0 is incompatible with flutter_test from sdk.
So, because app depends on both flutter_test from sdk and analyzer ^6.3.0, version solving failed.
exit code 1
Try also adding an override for meta
:
dependency_overrides:
analyzer: ^6.3.0
meta: ^1.11.0
Note that the constraint on meta was increased here https://github.com/flutter/flutter/commit/3e60999b1155bb7784f2ff6c6372eb535fa43d82. I don't know anything about how flutter actually does releases, or what the next release will be, but the first release version this is tagged with is 3.16.0-10.0.pre
, so it will likely be a part of the 3.16 release? I don't know if that is the next stable release though.
@rasitayaz note that I also checked with the analyzer team, and it looks like version 5.8.0 of the analyzer should also work, the meta constraint at that point was only ^1.7.0.
I am going to close this issue but feel free to chime back in if you are still blocked
Thank you so much for your help! Overriding both meta & analyzer worked. Though I had to set analyzer to 5.8.0 as you mentioned in your other comment. With 6.3.0 I was getting a different error, dropping it here in case it would be helpful for the development team:
The error looks like just a result of the override causing you to get an invalid combination of packages (as is generally the danger with overrides). So probably nothing to do there, but thanks :)
I'm using
build_runner: ^2.4.6
.When I run
dart run build_runner build --delete-conflicting-outputs
, with the following piece of code:I'm getting following errors: