What is the caret sign (^) before the dependency version number in Flutter's pubspec.yaml?

前端 未结 3 1187
萌比男神i
萌比男神i 2020-12-10 00:44

In the pubspec.yaml file of my Flutter project there is a caret (^) before the version number of some of the dependencies.

dependen         


        
3条回答
  •  旧巷少年郎
    2020-12-10 00:56

    The caret sign ^ means the specified version and all newer versions that don't introduce breaking changes relative to the specified version.

    Dart follows Semantic Versioning and suggests that to be used for package maintainers as well.

    Semantic Versioning defines that

    • For versions >= 1.0.0, the major version needs to be incremented for breaking changes.
    • For versions < 1.0.0, the minor version needs to be incremented for breaking changes.

    Example:

    ^2.4.3 means >= 2.4.3 < 3.0.0

    ^0.17.19 means >= 0.17.19 <0.18.0

提交回复
热议问题