setState method

  1. @override
void setState(
  1. VoidCallback fn
)
inherited

Allows 'external' routines can call this function.

Implementation

// Note not 'protected' and so can be called by 'anyone.' -gp
@override
void setState(VoidCallback fn) {
  if (_rebuildAllowed) {
    _rebuildAllowed = false;

    // Don't bother if the State object is disposed of.
    if (mounted) {
      /// Refresh the interface by 'rebuilding' the Widget Tree
      /// Call the State object's setState() function.
      super.setState(fn);
    }
    _rebuildAllowed = true;
  } else {
    /// Can't rebuild at this moment but at least make the request.
    _rebuildRequested = true;
  }
}