6

I created a new flutter project where I put the flutter_bloc dependency but when I do flutter pub get I have this error.

[bloc] flutter pub get Running "flutter pub get" in bloc...
Because bloc depends on flutter_bloc ^6.0.1 which depends on bloc ^6.0.0, bloc ^6.0.0 is required.

So, because bloc is 1.0.0+1, version solving failed. pub get failed (1; So, because bloc is 1.0.0+1, version solving failed.) exit code 1 can someone help me please?

Mon fichier pubspec.yaml

nvoigt
  • 75,013
  • 26
  • 93
  • 142
biros
  • 321
  • 2
  • 7

3 Answers3

16

I solved my problem because I created the project with the name block and it created conflicts with flutter_bloc. Thanks to those who bothered to read my question

biros
  • 321
  • 2
  • 7
0

You can fix this bug by changing versions of a package which you need in the app. I have a problem with flutter_bloc: 7.0.1 and bloc: 7.0.1 versions and just add

flutter_bloc: any

bloc: any
Abdulrahim Klis
  • 388
  • 3
  • 9
  • This doesn't work. Error on line 33, column 3 of pubspec.yaml: A package may not list itself as a dependency. ╷ 33 │ bloc: any │ ^^^^ ╵ pub get failed (65; ╵) – Apoorva Nataraja Oct 18 '22 at 02:03
0

Rename your application name from 'bloc' to 'anythingYouPrefer', the reason for your problem is contradiction with the package and your application name

iamJohnvesly
  • 391
  • 3
  • 5