didChangeLocales method

  1. @protected
  2. @mustCallSuper
  3. @override
void didChangeLocales(
  1. List<Locale>? locales
)
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 didChangeLocales(List<Locale>? locales) {
  // A triggered system event
  _hadSystemEvent = true;

  ///
  /// This method exposes notifications from [Window.onLocaleChanged].

  /// No 'setState()' functions are allowed to fully function at this point.
  _setStateAllowed = false;

  for (final con in _controllerList) {
    con.didChangeLocales(locales);
  }

  _setStateAllowed = true;

  if (_setStateRequested) {
    _setStateRequested = false;
    // Only the latest State is rebuilt
    if (isEndState) {
      /// Perform a 'rebuild' if requested.
      setState(() {});
    }
  }
}