version constant

PubspecVersion const version

Version

Current app version

Every package has a version. A version number is required to host your package on the pub.flutter-io.cn site, but can be omitted for local-only packages. If you omit it, your package is implicitly versioned 0.0.0.

Versioning is necessary for reusing code while letting it evolve quickly. A version number is three numbers separated by dots, like 0.2.43. It can also optionally have a build ( +1, +2, +hotfix.oopsie) or prerelease (-dev.4, -alpha.12, -beta.7, -rc.5) suffix.

Each time you publish your package, you publish it at a specific version. Once that’s been done, consider it hermetically sealed: you can’t touch it anymore. To make more changes, you’ll need a new version.

When you select a version, follow semantic versioning.

Implementation

static const PubspecVersion version = (
  /// Non-canonical string representation of the version as provided
  /// in the pubspec.yaml file.
  representation: r'0.1.11',

  /// Returns a 'canonicalized' representation
  /// of the application version.
  /// This represents the version string in accordance with
  /// Semantic Versioning (SemVer) standards.
  canonical: r'0.1.11',

  /// MAJOR version when you make incompatible API changes.
  /// The major version number: 1 in "1.2.3".
  major: 0,

  /// MINOR version when you add functionality
  /// in a backward compatible manner.
  /// The minor version number: 2 in "1.2.3".
  minor: 1,

  /// PATCH version when you make backward compatible bug fixes.
  /// The patch version number: 3 in "1.2.3".
  patch: 11,

  /// The pre-release identifier: "foo" in "1.2.3-foo".
  preRelease: <String>[],

  /// The build identifier: "foo" in "1.2.3+foo".
  build: <String>[],
);