Skip to content

Commit 9434bb6

Browse files
authored
Return null when locale has not been set in loocale closure. (flutter#6936)
1 parent 4b233f0 commit 9434bb6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/ui/hooks.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,12 @@ void _updateWindowMetrics(double devicePixelRatio,
4242

4343
typedef _LocaleClosure = String Function();
4444

45-
String _localeClosure() => window.locale.toString();
45+
String _localeClosure() {
46+
if (window.locale == null) {
47+
return null;
48+
}
49+
return window.locale.toString();
50+
}
4651

4752
@pragma('vm:entry-point')
4853
_LocaleClosure _getLocaleClosure() => _localeClosure;

0 commit comments

Comments
 (0)