=2.7.0 <3.0. 0' "而不是 "^2.7.0 "-6ren"> =2.7.0 <3.0. 0' "而不是 "^2.7.0 "-诚然,我对semver的理解非常有限。 这个 environment: sdk: ^2.7.0 相当于这个 environment: sdk: '>=2.7.0 =2.7.0 =2.7.0 =-6ren">
gpt4 book ai didi

flutter - 为什么 pubspec environment/sdk/uses "' >=2.7.0 <3.0. 0' "而不是 "^2.7.0 "

转载 作者:行者123 更新时间:2023-12-05 01:31:34 25 4
gpt4 key购买 nike

诚然,我对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 使用后者 代替前者 有什么原因吗,

这可以说是更熟悉和 consistent

最佳答案

一些定义:

  • ^2.7.0Caret syntax
  • >=2.7.0 <3.0.0Traditional 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'

关于flutter - 为什么 pubspec environment/sdk/uses "' >=2.7.0 <3.0. 0' "而不是 "^2.7.0 ",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66116090/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com