didChangeLocale method

  1. @protected
  2. @mustCallSuper
  3. @override
void didChangeLocale(
  1. Locale locale
)
inherited

Called when the system tells the app that the user's locale has changed. For example, if the user changes the system language settings.

Implementation

@protected
@mustCallSuper
@override
void didChangeLocale(Locale locale) {
  ///
  /// This method exposes notifications from [Window.onLocaleChanged].

  /// No 'setState()' functions are allowed to fully function at this point.
  _rebuildAllowed = false;
  for (final listener in _beforeList) {
    listener.didChangeLocale(locale);
  }
  for (final con in _controllerList) {
    con.didChangeLocale(locale);
  }
  for (final listener in _afterList) {
    listener.didChangeLocale(locale);
  }
  _rebuildAllowed = true;
  if (_rebuildRequested || _inTester) {
    _rebuildRequested = false;

    /// Perform a 'rebuild' if requested.
    refresh();
  }
}