pub get failed (1; Because note requires SDK version >=1.18.0-6.0.pre <2.0.0, version solving failed.)

Viewed 18936

i am trying to use flutter SVG the latest version, but i faced a problem with my SDK version. i changed it to what the error message said,But i still faces the same problem!

the error message is: pub get failed (1; Because flutter_app depends on flutter_svg >=0.18.0 which requires Flutter SDK version >=1.18.0-6.0.pre <2.0.0, version solving failed.)

environment:
  sdk: ">=1.18.0-6.0.pre <2.0.0"

dependencies:
  flutter:
    sdk: flutter


  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.3
  flutter_svg: ^0.19.1
4 Answers

Probably your project is created flutter beta channel or any downgrade channel. So First run:

  • flutter doctor -v

If your current flutter channel is beta ? then run command below:

  • flutter channel stable
  • flutter upgrade
  • flutter pub get

I hope solve your problem.

to upgrade your SDK do this in terminal:

flutter channel master
flutter upgrade

The channel master has the most recent build but it's not stable. So I advise you to try flutter channel stable first.

Probably your project is created years ago. First run flutter upgrade, then update SDK to sdk: ">=2.7.0 <3.0.0", and then pub get

I had a similar issue with a different package. Seems like flutter_svg moved to a new flutter beta version and you are on the stable channel. You need to use an older version of the flutter_svg package which uses an older version of flutter

Related