Dart packages use semantic versioning with a pre-1.0.0 variation where the version numbers are shifted to the right before a 1.0.0 release; see also the package:pub_semver semantics. Note that the Dart team culture was previously to keep packages at 0.x for a long time, whereas now we prefer to publish 1.0.0 as soon as feasible to avoid confusion over these patterns.
1.0.0 or later: major.minor.patch.1.0.0: 0.major.minor, where the second number is bumped for breaking changes, such as 0.4.2 to 0.5.0-wip, and the third number is bumped for non-breaking features and bug fixes, such as 0.4.2 to 0.4.3-wip. Historical 0.x releases occasionally used +1 build suffixes for patches, but new changes should avoid + suffixes.Choose the version bump based on the impact of the change:
pubspec.yaml executables entry.pubspec.yaml executables entry.environment.sdk or runtime dependencies constraint updates, or any other change that does not impact calling code.Whenever the code in the repo differs from the latest version published on pub.dev, both pubspec.yaml and CHANGELOG.md must use a -wip version. We bump to -wip on the first change after a release, even if we don‘t plan on publishing the code in that state or if the change doesn’t impact consumers.
When opening or merging a PR, check the current version in pubspec.yaml and CHANGELOG.md:
1.2.3: Perform the appropriate version bump, append -wip in pubspec.yaml, and add a matching ## <version>-wip section at the top of CHANGELOG.md.-wip version, such as 1.2.4-wip: Compare the existing -wip bump against the bump required for your change. If your change requires a larger bump, such as from a patch bump to a minor bump when adding a feature, update pubspec.yaml and rename the existing ## <version>-wip heading in CHANGELOG.md in place.pub.dev, at 0.1.0-wip: Keep 0.1.0-wip and the - Initial release. entry without adding per-PR changelog entries until after the first release.CHANGELOG.md-wip section.README.md updates, or dev_dependencies and dependency_overrides changes:-wip section, add the ## <version>-wip heading with no bullet items below it.-wip version, leave CHANGELOG.md untouched and apply the skip-changelog-check PR label.-wip section, such as bumping an SDK or dependency constraint again before publishing, update or remove the existing -wip bullet in place instead of adding a duplicate entry.main when a release landed while your PR was open.Whenever you have the occasion to make a breaking version change, check if there are other minor breaking changes that should come with it.
next-breaking-release.@deprecated members and remove them.In most packages a breaking version bump should be rare. Before making a breaking change you should weight many factors against the value provided by the change. Some of these factors include:
All of these packages will have to release a new version, and possibly make changes if they were actually broken by the changes.
Be very careful about changes like this - as they can have much larger cascading effects.
Example: Changing a sync API to be async. This could cause other packages to change their APIs to also be async, so they also have to do a breaking change.
Anything which could break internal projects is potentially much more difficult to roll out. The entire internal codebase typically has to be migrated at once at the same time as the roll.
This can cause cascading issues in rolling all the packages that depend on your package internally, so it is important to take this consideration seriously.
For this reason it is recommended that any potentially breaking change be ran through an internal presubmit before publishing externally.
This can also be mitigated by rolling out the breaking change in an incremental way, where both the new behavior can be opted into and the old is the default for some period of time. This allows internal code to be migrated one project at a time and then the old behavior can be removed once everything is migrated.
-wip from the version in both the pubspec and the changelog. It is OK to do this in the same PR as another change if that change should be published immediately.pub publish. Don't ignore any warnings or errors reported by pub unless you are completely confident they are safe to ignore.git tag v1.2.3). Check other tags in the repo to decide whether to include a leading v in the tag (git tag or git tag -l). New repositories should prefer to include the v. In a mono repo, start the tag with the name of the package. For example build_runner-v1.7.0. Be sure to git push --tags after adding a tag. Note that you can tag a specific commit - instead of just tagging head - with git tag v1.2.3 <commit-hash>.Typical package rolls into the Dart SDK are atomic for all packages in a mono repo. If some change in the history of the main branch for the repository is blocking the roll and a required fix was committed after the roll became blocked there are extra steps to roll only specific changes to the SDK.
The goal is to have a commit with the contents that need to be synced to the SDK, and put exactly that commit in the history of the main branch.
git checkout -b <branch name> <SHA>.If there is any confusion, reach out to an admin for the repo early and they will be able to help.