to my, admittedly very limited, understanding of semver
this
environment:
sdk: ^2.7.0
is equivalent to this
environment:
sdk: '>=2.7.0 <3.0.0'
this format is strictly enforced for package publishing
Package validation found the following error:
* ^ version constraints aren't allowed for SDK constraints since older versions of pub don't support them.
Expand it manually instead:
environment:
sdk: ">=2.7.0 <3.0.0"
Sorry, your package is missing a requirement and can't be published yet.
is there any reason why flutter uses the latter in place of the former approach,
which is arguably more familiar and consistent ?
Some definitions :
^2.7.0 is Caret syntax>=2.7.0 <3.0.0 is Traditional syntaxAnd based on the documentation:
Because caret syntax was introduced in Dart 1.8.3, it requires an SDK constraint (using traditional syntax) to ensure that older versions of pub don’t try to process it. For example:
environment:
sdk: '>=1.8.3 <3.0.0'
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