startLeadingNavButtonPressedListener function

CancelListener startLeadingNavButtonPressedListener(
  1. LeadingNavbuttonPressedlistener listener
)

Listens for when the leading navigation button is pressed.

var navPressedCancel = startLeadingNavButtonPressedListener(() {
  print('flutter nav button pressed');
});

Returns a function that can cancel the listener.

Implementation

CancelListener startLeadingNavButtonPressedListener(
    LeadingNavbuttonPressedlistener listener) {
  var subscription = _leadingNavButtonPressedChannel
      .receiveBroadcastStream(eventSinkId.leadingNavButtonPressedId.index)
      .listen((stub) {
    listener();
  }, cancelOnError: true);

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