Flutter and false flutter_test dependency

TIL 5. Juni 2020

Again a chapter where I got a bug in Flutter and I had to solve it somehow.

The following error came now more often:

Because every version of flutter_test from sdk depends on path 1.6.4 and app_name depends on path ^1.7.0, flutter_test from sdk is forbidden.
So, because app_name depends on flutter_test any from sdk, version solving failed.
Running "flutter pub get" in easy-by-design-flutter...
pub get failed (1; So, because app_name depends on flutter_test any from sdk, version solving failed.)

Up to now I have always solved this error by changing the flutter channel. But I did not want to do that this time. I wanted to stay on the Stable Channel.

So I did some research and deleted the pubcache and the lockfile:

rm -rf ~/.pub-cache
rm -rf pubspec.lock
flutter pub get

The error persisted. After that I looked at all versions in pubspec.yaml and updated them manually.

The error persisted. Silly error!

After some research I found the following command:

flutter update-packages --force-upgrade

After many packages were updated, I could run the flutter pub get again and build the project again.

Tags

Tim Friedrich

Hausherr des Blogs, - an mir kommst du hier nicht vorbei! Daher ein fröhliches Hallo und herzliches Willkommen im Blog.

Großartig! Das Abonnement wurde erfolgreich abgeschlossen.
Großartig! Schließen Sie als Nächstes die Kaufabwicklung ab, um vollen Zugriff zu erhalten.
Willkommen zurück! Sie haben sich erfolgreich angemeldet.
Erfolg! Ihr Konto ist vollständig aktiviert, Sie haben jetzt Zugang zu allen Inhalten.