startZoomChangedListener function

CancelListener startZoomChangedListener(
  1. ZoomChangedListener listener
)

Listens for when the current document's zoom ratio is changed.

var zoomChangedCancel = startZoomChangedListener((zoom) {
  print('flutter zoom changed. Current zoom is: $zoom');
});

Returns a function that can cancel the listener.

Implementation

CancelListener startZoomChangedListener(ZoomChangedListener listener) {
  var subscription = _zoomChangedChannel
      .receiveBroadcastStream(eventSinkId.zoomChangedId.index)
      .listen(listener, cancelOnError: true);

  return () {
    subscription.cancel();
  };
}