Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pubspec.yaml has no lower-bound SDK constraint

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'
like image 608
Feroz Khan Avatar asked Feb 10 '21 05:02

Feroz Khan


2 Answers

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.

like image 105
Joel G Mathew Avatar answered Sep 23 '22 05:09

Joel G Mathew


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.

like image 40
Feroz Khan Avatar answered Sep 19 '22 05:09

Feroz Khan