Skip to content

Instantly share code, notes, and snippets.

@yongjhih
Created June 10, 2020 04:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yongjhih/04de7ed69652ca923c8394f338377521 to your computer and use it in GitHub Desktop.
Save yongjhih/04de7ed69652ca923c8394f338377521 to your computer and use it in GitHub Desktop.
extension LocalizationContextX<T extends BuildContext> on T {
Locale locale() {
return Localizations.localeOf(this);
}
Locale localeOrNull() {
return Localizations.localeOf(this, nullOk: true);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment