startAnnotationToolbarItemPressedListener function

CancelListener startAnnotationToolbarItemPressedListener(
  1. AnnotationToolbarItemPressedListener listener
)

Listens for when a custom annotation toolbar item has been pressed.

var itemPressedCancel = startAnnotationToolbarItemPressedListener((id) {
  print('flutter toolbar item $id pressed');
});

Returns a function that can cancel the listener. Custom toolbar items can be added using the Config.annotationToolbars config.

Implementation

CancelListener startAnnotationToolbarItemPressedListener(
    AnnotationToolbarItemPressedListener listener) {
  var subscription = _annotationToolbarItemPressedChannel
      .receiveBroadcastStream(eventSinkId.annotationToolbarItemPressedId.index)
      .listen(listener, cancelOnError: true);

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