addIntersectionChangeListener method

void addIntersectionChangeListener(
  1. IntersectionChangeCallback callback
)

Implementation

void addIntersectionChangeListener(IntersectionChangeCallback callback) {
  // Init things
  if (_listeners == null) {
    _listeners = List.empty(growable: true);
    _onIntersectionChange = _dispatchChange;
    _intersectionObserverLayer.layer?.onIntersectionChange = _dispatchChange;
  }
  // Avoid same listener added twice.
  if (!_listeners!.contains(callback)) {
    _listeners!.add(callback);
  }
}