I was taking MDC101 flutter code lab. I cloned the starter project from the git repository as per the instructions but after clonning done, I executed flutter pub get
and it gave me the following error.
pubspec.yaml has no lower-bound SDK constraint.
You should edit pubspec.yaml to contain an SDK constraint:
environment:
sdk: '>=2.10.0 <3.0.0'
If you received this error even when your pubspec.yaml file contained the correct sdk line, be sure to check subfolders in your main folder. This was noted to happen while doing a flutter packages get
from the font_awesome_flutter package. The reason was that even though the main pubspec.yaml contained the correct line, there was an offending example/pubspec.yaml
. Add the lines to that file:
environment:
sdk: ">=2.7.0 <3.0.0"
Referenced issue.
As per the error instructions I added the following in my pubspec.yaml
environment:
sdk: '>=2.10.0 <3.0.0'
And then I executed flutter pub get
and it's working fine now.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With