Reputation: 543
I see the symbol ^
a lot when a version is declared in a flutter pubspec file. how is:
http: ^0.13.3
different from http: 0.13.3
or even this http: '0.13.3'
Upvotes: 2
Views: 1246
Reputation: 1189
There are major, minor, and patch represent the different releases of a package.
npm uses the tilde (~)
and caret (^)
to designate which patch and minor versions to use respectively.
So if you see ~1.0.2
it means to install version 1.0.2
or the latest patch version such as 1.0.4
. If you see ^1.0.2
it means to install version 1.0.2
or the latest minor or patch version such as 1.1.0
.
But if in your npm package.json file you’re referencing a package that hasn’t reached version 1.0
yet, using the caret symbol will only grab the patch version.
Source: https://michaelsoolee.com/npm-package-tilde-caret/
Upvotes: 1
Reputation: 6357
pub.dev
packages use SemVer or semantic versioning.
The ^
character means “compatible with”
So taking the example
How is http: ^0.13.3 different from http: 0.13.3 or even this http: '0.13.3'
Would mean >=0.13.3 <1.0.0
You can an explanation of all modifiers at Semver cheatsheet
Upvotes: 3