'pub get failed (1; Because note requires SDK version >=1.18.0-6.0.pre <2.0.0, version solving failed.)
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
Solution 1:[1]
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.
Solution 2:[2]
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.
Solution 3:[3]
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
Solution 4:[4]
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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Mehedi Hasan |
Solution 2 | |
Solution 3 | Absaar Hunzai |
Solution 4 | Morad |