updateShouldNotify method

  1. @override
bool updateShouldNotify(
  1. covariant InheritedWidget oldWidget
)
inherited

Determine if its dependencies should be updated.

Implementation

@override
bool updateShouldNotify(covariant InheritedWidget oldWidget) {
  //
  // Don't if the State object is defunct.
  if (!mounted) {
    return false;
  }

  // Record the triggered event
  assert(() {
    if (_debugPrintEvents) {
      debugPrint(
          '$_consoleLeadingLine updateShouldNotify() in $_consoleClassName');
    }
    return true;
  }());

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

  bool update = true;

  for (final con in controllerList) {
    update = con.updateShouldNotify(oldWidget);
    // If even one controller says 'no', there's no update.
    if (!update) {
      break;
    }
  }

  _setStateAllowed = true;

  /// No 'setState()' function is necessary
  /// The framework always calls build with a hot reload.
  _setStateRequested = false;

  return update;
}