bump_version

Auto-bump the version: field in your Flutter/Dart pubspec.yaml before every release build — no more manually editing x.y.z+N by hand.

Install (global CLI)

dart pub global activate bump_version

Usage

Run from your project root (where pubspec.yaml lives):

# bump build number only: 1.2.3+7 -> 1.2.3+8
bump_version

# bump patch: 1.2.3+7 -> 1.2.4+8
bump_version patch

# bump minor: 1.2.3+7 -> 1.3.0+8
bump_version minor

# bump major: 1.2.3+7 -> 2.0.0+8
bump_version major

# point at a different pubspec.yaml
bump_version patch -f path/to/pubspec.yaml

Then build as usual:

flutter build appbundle

Why not touch android/app/build.gradle?

Standard Flutter projects read versionCode/versionName directly from pubspec.yaml via flutter.versionCode / flutter.versionName in android/app/build.gradle. Bumping pubspec.yaml is enough unless your project hardcodes those values instead.

As a dev_dependency + script

dev_dependencies:
  bump_version: ^0.1.0
dart run bump_version patch

API

The package exports BumpType, bumpVersionLine, bumpPubspecLines, and bumpTypeFromString for use from Dart code. Every bump increments the build number. Major, minor, and patch bumps also update the semantic version and reset lower components as expected.

Libraries

bump_version
Auto-bump the version and build number in a pubspec.yaml file.