addIntersectionChangeListener method

void addIntersectionChangeListener(
  1. IntersectionChangeCallback callback, [
  2. List<double> thresholds = const [0.0]
])

Implementation

void addIntersectionChangeListener(IntersectionChangeCallback callback, [List<double> thresholds = const [0.0]]) {
  // 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);
    _thresholds = thresholds;
  }
}