onVisibilityChanged property

VisibilityChangedCallback? get onVisibilityChanged

Implementation

VisibilityChangedCallback? get onVisibilityChanged => _onVisibilityChanged;
set onVisibilityChanged (VisibilityChangedCallback? value)

Implementation

set onVisibilityChanged(VisibilityChangedCallback? value) {
  if (_onVisibilityChanged == value) {
    return;
  }
  _compositionCallbackCanceller?.call();
  _compositionCallbackCanceller = null;
  _onVisibilityChanged = value;

  if (value == null) {
    // Remove all cached data so that we won't fire visibility callbacks when
    // a timer expires or get stale old information the next time around.
    forget(key);
  } else {
    markNeedsPaint();
    // If an update is happening and some ancestor no longer paints this RO,
    // the markNeedsPaint above will never cause the composition callback to
    // fire and we could miss a hide event. This schedule will get
    // over-written by subsequent updates in paint, if paint is called.
    _scheduleUpdate();
  }
}