21

I see this +1 in a some flutter dependencies and have been wondering what it means because i have been seeing it more often these days.

Sample pubspec.yaml

dependencies:
  flutter:
    sdk: flutter
  cloud_firestore: ^0.8.1+1
  sqflite: 0.12.2+1
  zoomable_image: ^1.2.1+1  

I have checked here but didn't find it.

What is the meaning? And can it also be +n eg +2?

nonybrighto
  • 8,752
  • 5
  • 41
  • 55
  • 2
    That is the build number. Even your build can be 1.0.0+2 that is read as version 1.0.0 build 2 by AppStore and Google play. – ishaan Dec 05 '18 at 06:35

2 Answers2

18

+ means it is a regular release build,
while - would indicate a pre-release build.
(No build number after x.y.z also indicates a release build like +)

The following part of the version is some build number that does not have a fixed format.

See also

From https://semver.org/spec/v2.0.0-rc.1.html

  1. A pre-release version MAY be denoted by appending a dash and a series of dot separated identifiers immediately following the patch version. Identifiers MUST be comprised of only ASCII alphanumerics and dash [0-9A-Za-z-]. Pre-release versions satisfy but have a lower precedence than the associated normal version. Examples: 1.0.0-alpha, 1.0.0-alpha.1, 1.0.0-0.3.7, 1.0.0-x.7.z.92.

  2. A build version MAY be denoted by appending a plus sign and a series of dot separated identifiers immediately following the patch version or pre-release version. Identifiers MUST be comprised of only ASCII alphanumerics and dash [0-9A-Za-z-]. Build versions satisfy and have a higher precedence than the associated normal version. Examples: 1.0.0+build.1, 1.3.7+build.11.e0f985a.

Hint: Pre-release versions (with -) are ignored by flutter packages get unless the - is explicitly part of the version constraint in pubspec.yaml like

foo_package: ^1.2.3-beta
Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
  • 1
    Thanks a lot for the explanation! – nonybrighto Dec 05 '18 at 14:12
  • https://dart.dev/tools/pub/versioning says `going to 0.1.2+1 indicates a change that doesn’t affect the public API`, apparently its not just a build number, or am I understanding this wrongly? – Michel Feinstein Aug 01 '19 at 02:40
  • You are right. If there is an API change then major or minor parts should be incremented. Otherwise it's not exactly specified how it can be used. It's up to you and perhaps the workflow you are using (for example with automatic builds and deploys) – Günter Zöchbauer Aug 01 '19 at 03:28
7

In Dart conventions the +1 is used when publishing a patch release where the first number in the version is 0. The version 1.2.1+1 is not idiomatic. Essentially there are two patterns in use depending on whether the author considers the package stable enough to reach 1.0.0:

  • 0.major.minor+patch
  • major.minor.patch
Nate Bosch
  • 10,145
  • 2
  • 26
  • 22