From 79bfcf7cd1f9eb9bdf438a7bb74eed7e89a0d5d8 Mon Sep 17 00:00:00 2001 From: GaryQian Date: Mon, 22 Oct 2018 11:05:44 -0700 Subject: [PATCH 1/3] Reland 'Pass null instead of 'none' locale' --- lib/ui/window.dart | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/ui/window.dart b/lib/ui/window.dart index 2c4f283214643..ca93f4874b15e 100644 --- a/lib/ui/window.dart +++ b/lib/ui/window.dart @@ -152,9 +152,6 @@ class Locale { /// the region subtag should be uppercase. const Locale(this._languageCode, [ this._countryCode ]) : assert(_languageCode != null); - /// Empty locale constant. This is an invalid locale. - static const Locale none = const Locale('', ''); - /// The primary language subtag for the locale. /// /// This must not be null. @@ -443,7 +440,7 @@ class Window { if (_locales != null && _locales.isNotEmpty) { return _locales.first; } - return Locale.none; + return null; } /// The full system-reported supported locales of the device. From 1b2df5976c88c3d27cc03f47e1fdfe0c3e1a4f26 Mon Sep 17 00:00:00 2001 From: GaryQian Date: Mon, 22 Oct 2018 12:28:00 -0700 Subject: [PATCH 2/3] Assert language code is not empty string --- lib/ui/window.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ui/window.dart b/lib/ui/window.dart index ca93f4874b15e..7c402ddaf8ed8 100644 --- a/lib/ui/window.dart +++ b/lib/ui/window.dart @@ -150,7 +150,7 @@ class Locale { /// Registry](https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry). /// Typically this means the primary language subtag should be lowercase and /// the region subtag should be uppercase. - const Locale(this._languageCode, [ this._countryCode ]) : assert(_languageCode != null); + const Locale(this._languageCode, [ this._countryCode ]) : assert(_languageCode != null), assert(_languageCode != ""); /// The primary language subtag for the locale. /// From ad13bbb35b4a14db8e5ad0db5617facd8ed50c77 Mon Sep 17 00:00:00 2001 From: GaryQian Date: Mon, 22 Oct 2018 13:43:03 -0700 Subject: [PATCH 3/3] Dart format --- lib/ui/window.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ui/window.dart b/lib/ui/window.dart index 7c402ddaf8ed8..28f91372460f2 100644 --- a/lib/ui/window.dart +++ b/lib/ui/window.dart @@ -150,7 +150,7 @@ class Locale { /// Registry](https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry). /// Typically this means the primary language subtag should be lowercase and /// the region subtag should be uppercase. - const Locale(this._languageCode, [ this._countryCode ]) : assert(_languageCode != null), assert(_languageCode != ""); + const Locale(this._languageCode, [ this._countryCode ]) : assert(_languageCode != null), assert(_languageCode != ''); /// The primary language subtag for the locale. ///