为什么 pubspec 环境/sdk/使用“'>=2.7.0 <3.0.0'”而不是“^2.7.0”
why pubspec environment / sdk / uses " '>=2.7.0 <3.0.0' " instead of " ^2.7.0 "
我对 semver
的理解非常有限
这个
environment:
sdk: ^2.7.0
相当于这个
environment:
sdk: '>=2.7.0 <3.0.0'
包发布严格执行此格式
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.
Flutter 使用 latter
代替 former
方法有什么原因吗,
哪个可以说更熟悉 consistent ?
一些定义:
^2.7.0
是 Caret syntax
>=2.7.0 <3.0.0
是 Traditional syntax
并基于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'
我对 semver
的理解非常有限这个
environment:
sdk: ^2.7.0
相当于这个
environment:
sdk: '>=2.7.0 <3.0.0'
包发布严格执行此格式
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.
Flutter 使用 latter
代替 former
方法有什么原因吗,
哪个可以说更熟悉 consistent ?
一些定义:
^2.7.0
是Caret syntax
>=2.7.0 <3.0.0
是Traditional syntax
并基于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'