Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Improve FlutterVersion docs #167674

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
Loading
from
Open

Conversation

ueman
Copy link
Contributor

@ueman ueman commented Apr 23, 2025

This improves the docs for the FlutterVersion class. In particular, it provides more context on what the various strings contain, and it includes some more guidance for using FlutterVersion.dartVersion.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@github-actions github-actions bot added the framework flutter/packages/flutter repository. See also f: labels. label Apr 23, 2025
Copy link
Contributor

@justinmc justinmc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few suggestions but otherwise looks good. Thanks for improving these docs.

packages/flutter/lib/src/services/flutter_version.dart Outdated Show resolved Hide resolved
packages/flutter/lib/src/services/flutter_version.dart Outdated Show resolved Hide resolved
packages/flutter/lib/src/services/flutter_version.dart Outdated Show resolved Hide resolved
@ueman ueman requested a review from justinmc May 6, 2025 12:34
Copy link
Contributor

@justinmc justinmc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

I'll look for a secondary reviewer.

Copy link
Contributor

@ValentinVignal ValentinVignal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines 18 to 21
/// The Flutter version used to compile the app.
/// The value is a [semantic versioning](https://semver.org/) string representing the
/// version of Flutter used to compile the app, possibly followed by whitespace and
/// other version and build details.
static const String? version =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flutter doesn't use semver, so this isn't accurate.

In particular there's no greater amount of breakage implied when the first number in the version increases, and there's no promise that no breaking API changes happen when the first number doesn't increase. See the list of Flutter breaking changes:
https://docs.flutter.dev/release/breaking-changes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here it says:

Flutter version: The version number of the Flutter SDK (for example, 3.0.0, 2.10.5). This follows semantic versioning, indicating the significance of changes between releases.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, that's a bug in the website, then — it'd be good to correct that.

The main point of Semantic Versioning, aka https://semver.org/, is that the first number in the version (the "major" version number) gets incremented when there's an incompatible API change. If Flutter followed that convention, then every release that's listed on https://docs.flutter.dev/release/breaking-changes would be a new major version. Instead of 1.20 it'd be 2.0.0, instead of 1.22 it'd be 3.0.0, and by now it'd be something like 17.0.0 instead of 3.29. As you can see, that's not the numbering that Flutter uses.

A developer who expects Semantic Versioning is going to be surprised when they upgrade from, for example, 3.27.x to 3.29.x and then run into one of the 6 different breaking changes listed for 3.29 on that page. So setting that expectation would be likely to lead to disappointment.

Comment on lines 47 to 52
/// The value is a [semantic versioning](https://semver.org/) string representing the
/// version of the Dart runtime used to compile the app, possibly followed by whitespace
/// and other version and build details.
///
/// On `dart:io` platforms it is more reliable to use [Platform.version].
static const String? dartVersion =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each doc comment should start with a short summary. See the style guide:
https://dart.dev/effective-dart/documentation#do-start-doc-comments-with-a-single-sentence-summary

For example on Platform.version:
https://api.dart.dev/dart-io/Platform/version.html
there's a paragraph similar to the first paragraph here — but before that, there's a much shorter paragraph, which is the summary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.