forget method

void forget(
  1. Key key
)

Forgets any pending visibility callbacks for the VisibilityDetector with the given key.

If the widget gets attached/detached, the callback will be rescheduled.

This method can be used to cancel timers after the VisibilityDetector has been detached to avoid pending timers in tests.

Example:

// Clean up after a specific widget
VisibilityDetectorController.instance.forget(Key('my-widget'));

Implementation

void forget(Key key) => VisibilityDetectorLayer.forget(key);