didChangePlatformBrightness method

  1. @protected
  2. @override
  3. @mustCallSuper
void didChangePlatformBrightness()
override

Called when the platform brightness changes.

Implementation

@protected
@override
@mustCallSuper
void didChangePlatformBrightness() {
  // A triggered system event
  _hadSystemEvent = true;

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

  for (final listener in _beforeList) {
    listener.didChangePlatformBrightness();
  }
  for (final con in _controllerList) {
    con.didChangePlatformBrightness();
  }
  for (final listener in _afterList) {
    listener.didChangePlatformBrightness();
  }

  _setStateAllowed = true;

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