Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions sites/docs/lib/src/components/layout/trailing_content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ class TrailingContent extends StatelessComponent {
final siteData = page.data.site;
final pageDate = pageData['date'] as String?;

final currentFlutterVersion =
siteData['currentFlutterVersion'] as String? ?? '';
final documentedFlutterVersion = _parseDocumentedFlutterVersion(
siteData['documentedFlutterVersion'],
);

final sourceInfo = page.sourceInfo;
final issueUrl = sourceInfo.issueUrl;
Expand All @@ -38,7 +39,7 @@ class TrailingContent extends StatelessComponent {
span([
.text(
'Unless stated otherwise, the documentation on '
'this site reflects Flutter $currentFlutterVersion. ',
'this site reflects Flutter $documentedFlutterVersion. ',
),
if (pageDate != null)
.text(
Expand Down Expand Up @@ -67,4 +68,24 @@ class TrailingContent extends StatelessComponent {
],
);
}

/// Returns the [rawVersionValue] as a version string in `major.minor` format.
///
/// Throws a [FormatException] if [rawVersionValue]
/// isn't in the expected version format.
static String _parseDocumentedFlutterVersion(Object? rawVersionValue) {
if (rawVersionValue is! String ||
!_documentedFlutterVersionPattern.hasMatch(rawVersionValue)) {
throw FormatException(
'documentedFlutterVersion in sites/docs/src/data/site.yml must be a '
'quoted string in "major.minor" format, such as "3.47". '
'Received: $rawVersionValue (${rawVersionValue.runtimeType}).',
);
}
return rawVersionValue;
}

static final RegExp _documentedFlutterVersionPattern = RegExp(
r'^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$',
);
}
2 changes: 1 addition & 1 deletion sites/docs/src/content/reference/supported-platforms.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: The platforms that Flutter supports by platform version.
showBreadcrumbs: false
---

As of Flutter {{site.currentFlutterVersion}},
As of Flutter {{site.documentedFlutterVersion}},
Flutter supports deploying apps on the following combinations of
hardware architectures and operating system versions.
These combinations are called _platforms_.
Expand Down
3 changes: 2 additions & 1 deletion sites/docs/src/data/site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ yt:
watch: 'https://www.youtube.com/watch'
playlist: 'https://www.youtube.com/playlist?list='

currentFlutterVersion: '3.47.2'
# The Flutter version reflected by the docs, as a quoted 'major.minor' string.
documentedFlutterVersion: '3.47'

# Settings for Jaspr.

Expand Down
Loading