Skip to content

Commit

Permalink
Return null when locale has not been set in loocale closure. (flutter…
Browse files Browse the repository at this point in the history
  • Loading branch information
GaryQian authored Dec 11, 2018
1 parent 4b233f0 commit 9434bb6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/ui/hooks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ void _updateWindowMetrics(double devicePixelRatio,

typedef _LocaleClosure = String Function();

String _localeClosure() => window.locale.toString();
String _localeClosure() {
if (window.locale == null) {
return null;
}
return window.locale.toString();
}

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

0 comments on commit 9434bb6

Please sign in to comment.