From 74ad159dac22317dc18b9877bd3ce0eaa32486ea Mon Sep 17 00:00:00 2001 From: Zachary Anderson Date: Fri, 22 Dec 2017 15:12:10 -0800 Subject: [PATCH] Ensure Platform.localeName isn't '_' --- lib/ui/hooks.dart | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ui/hooks.dart b/lib/ui/hooks.dart index 9de206dac3866..a5cfa6a0c85ec 100644 --- a/lib/ui/hooks.dart +++ b/lib/ui/hooks.dart @@ -41,7 +41,11 @@ void _updateWindowMetrics(double devicePixelRatio, typedef String LocaleClosure(); -String _localeClosure() => window._locale.toString(); +String _localeClosure() { + const String enUS = 'en_US'; + final String locale = window?._locale?.toString() ?? enUS; + return (locale == '_') ? enUS : locale; +} LocaleClosure _getLocaleClosure() => _localeClosure;