[web] Match the behavior of other platforms in Web Locale.toString if the country code is an empty string#176862
Merged
auto-submit[bot] merged 1 commit intoflutter:masterfrom Oct 13, 2025
Conversation
… the country code is an empty string Fixes flutter#176666
Contributor
There was a problem hiding this comment.
Code Review
This pull request correctly adjusts the behavior of Locale.toString() on the web to align with other platforms, specifically by not including an empty country code in the string representation. The logic change in platform_dispatcher.dart is sound, and the new test case in locale_test.dart effectively validates this fix. I've provided a couple of suggestions to improve the code's readability and make it more idiomatic by removing unnecessary non-null assertions.
| String _rawToString(String separator) { | ||
| final StringBuffer out = StringBuffer(languageCode); | ||
| if (scriptCode != null) { | ||
| if (scriptCode != null && scriptCode!.isNotEmpty) { |
Contributor
There was a problem hiding this comment.
| out.write('$separator$scriptCode'); | ||
| } | ||
| if (_countryCode != null) { | ||
| if (_countryCode != null && countryCode!.isNotEmpty) { |
Contributor
There was a problem hiding this comment.
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Oct 14, 2025
…tring if the country code is an empty string (flutter/flutter#176862)
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Oct 14, 2025
…tring if the country code is an empty string (flutter/flutter#176862)
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Oct 14, 2025
…tring if the country code is an empty string (flutter/flutter#176862)
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Oct 14, 2025
…tring if the country code is an empty string (flutter/flutter#176862)
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Oct 14, 2025
…tring if the country code is an empty string (flutter/flutter#176862)
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Oct 14, 2025
…tring if the country code is an empty string (flutter/flutter#176862)
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Oct 15, 2025
…tring if the country code is an empty string (flutter/flutter#176862)
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Oct 15, 2025
…tring if the country code is an empty string (flutter/flutter#176862)
auto-submit bot
pushed a commit
to flutter/packages
that referenced
this pull request
Oct 15, 2025
Manual roll Flutter from e11e2c1 to 7cd821c (73 revisions) Manual roll requested by [email protected] flutter/flutter@e11e2c1...7cd821c 2025-10-14 [email protected] Fix computeDistanceToActualBaseline throws when accessing child size (flutter/flutter#176906) 2025-10-14 [email protected] iOS can set application locale before view controller is set (flutter/flutter#176592) 2025-10-14 [email protected] Roll ANGLE to a branch based on d9fa255a5c22 (flutter/flutter#176747) 2025-10-14 [email protected] Relands "Fixes keyboard selects disabled radio" (flutter/flutter#176977) 2025-10-14 [email protected] Fix expansion tile is missing state announcement on non-Apple platforms (flutter/flutter#175480) 2025-10-14 [email protected] impeller: allows access of float uniforms by name (flutter/flutter#176728) 2025-10-14 [email protected] Roll dart sdk to 3.11.0-17.0.dev (flutter/flutter#176947) 2025-10-13 [email protected] Move iOS integration tests (flutter/flutter#176940) 2025-10-13 [email protected] Make sure that an InputDatePickerFormField doesn't crash in 0x0 envir… (flutter/flutter#176047) 2025-10-13 [email protected] [web] Match the behavior of other platforms in Web Locale.toString if the country code is an empty string (flutter/flutter#176862) 2025-10-13 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Fixes keyboard selects disabled radio (#176727)" (flutter/flutter#176958) 2025-10-13 [email protected] Fixes keyboard selects disabled radio (flutter/flutter#176727) 2025-10-13 [email protected] Roll Packages from e319c40 to d062181 (2 revisions) (flutter/flutter#176916) 2025-10-13 [email protected] Roll SwiftShader to 794b0cfce1d8 (flutter/flutter#176806) 2025-10-13 [email protected] Make DropdownMenu generic type non nullable (flutter/flutter#176711) 2025-10-12 [email protected] Roll Fuchsia Linux SDK from BWGpRvpdQh-HJpq1c... to _dd0Jv50H0oUI2Ad8... (flutter/flutter#176895) 2025-10-11 [email protected] Roll Fuchsia Linux SDK from JpiUsek1hU5r9QVKP... to BWGpRvpdQh-HJpq1c... (flutter/flutter#176880) 2025-10-11 [email protected] fix: content hash check for LUCI_CONTEXT (flutter/flutter#176867) 2025-10-11 [email protected] Feat: make tooltip position customizeable (flutter/flutter#175047) 2025-10-11 [email protected] Roll Dart SDK from d88d8bf2b53c to 65b171958c93 (3 revisions) (flutter/flutter#176871) 2025-10-11 [email protected] feat: apply radioGroup role to segmented control widgets (flutter/flutter#176157) 2025-10-10 [email protected] Make sure that a CheckboxMenuButton doesn't crash in 0x0 environment (flutter/flutter#176450) 2025-10-10 [email protected] [WebParagraph] Support for more styles, placeholders, decorations, etc (flutter/flutter#172853) 2025-10-10 [email protected] Set up a version of build_ios_framework_module_test that only runs on x64 machines and extend its timeout (flutter/flutter#176811) 2025-10-10 [email protected] Roll Packages from 0b41de3 to e319c40 (1 revision) (flutter/flutter#176833) 2025-10-10 [email protected] [tool/dap] Forward app.warning events from Flutter to DAP client (flutter/flutter#176827) 2025-10-10 [email protected] Roll Dart SDK from 70c00d3ceb3a to d88d8bf2b53c (1 revision) (flutter/flutter#176830) 2025-10-10 [email protected] Remove unnecessary nullable types in examples. (flutter/flutter#176713) 2025-10-10 [email protected] Roll Fuchsia Linux SDK from xArtL4DH0FsdwSqG_... to JpiUsek1hU5r9QVKP... (flutter/flutter#176822) 2025-10-10 [email protected] Cleanup OutlinedButton.icon documentation and implementation (flutter/flutter#176630) 2025-10-10 [email protected] [HCPP] Properly remove hcpp views that are no longer visible (flutter/flutter#176742) 2025-10-10 [email protected] Make sure that an InputChip doesn't crash in 0x0 environment (flutter/flutter#175930) 2025-10-10 [email protected] Update Flutter templates' Dart style (flutter/flutter#175963) 2025-10-10 [email protected] Make sure that a DropdownButtonFormField doesn't crash in 0x0 environ… (flutter/flutter#174958) 2025-10-10 [email protected] Make sure that an InkWell doesn't crash in 0x0 environment (flutter/flutter#175871) 2025-10-10 [email protected] Handle#6537 end drawer button (flutter/flutter#173026) 2025-10-10 [email protected] Roll Dart SDK from a9b7bd4b0b32 to 70c00d3ceb3a (4 revisions) (flutter/flutter#176815) 2025-10-10 [email protected] Change default Linux thread policy to merge platform and UI threads. (flutter/flutter#176759) 2025-10-09 [email protected] [ Tool ] Roll package:dwds to 26.0.0 (flutter/flutter#176808) 2025-10-09 [email protected] Update `CHANGELOG` to include 3.35.6 notes (flutter/flutter#176803) 2025-10-09 [email protected] Announce text and button together when DropdownMenu is treated as a button (flutter/flutter#176428) 2025-10-09 [email protected] [native_assets] create macOS CCompilerConfig via xcrun --find (flutter/flutter#175717) 2025-10-09 [email protected] [Impeller] Fix broken links in README. (flutter/flutter#176770) 2025-10-09 [email protected] Fix links to Custom Flutter Engine Embedders in README. (flutter/flutter#175807) ...
reidbaker
pushed a commit
to AbdeMohlbi/flutter
that referenced
this pull request
Dec 10, 2025
… the country code is an empty string (flutter#176862) Fixes flutter#176666
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Feb 11, 2026
…tring if the country code is an empty string (flutter/flutter#176862)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #176666