track method

void track(
  1. Element element,
  2. OnElementEvent onResize
)

Tracks element resize events.

element Element to track. onResize Callback to call when size changes.

Implementation

void track(Element element, OnElementEvent onResize) {
  var resizeObserver = _resizeObserver;

  if (resizeObserver != null) {
    _trackResizeObserver(resizeObserver, element, onResize);
    return;
  }

  var trackElementValue = _trackElementValue;

  if (trackElementValue != null) {
    _trackResizeFallbackByElementValue(trackElementValue, element, onResize);
    return;
  }

  throw UnsupportedError("Can't track element resize");
}