startAppBarButtonPressedListener function

CancelListener startAppBarButtonPressedListener(
  1. AppBarButtonPressedListener listener
)

Listens for when a custom app bar item has been pressed.

var itemPressedCancel = startAppBarButtonPressedListener((id) {
  print('flutter app bar item $id pressed');
});

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

Implementation

CancelListener startAppBarButtonPressedListener(AppBarButtonPressedListener listener) {
  var subscription = _appBarButtonPressedChannel
      .receiveBroadcastStream(eventSinkId.appBarButtonPressedId.index)
      .listen(listener, cancelOnError: true);

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