addListener method

void addListener(
  1. MpnDeviceListener listener
)

Adds a listener that will receive events from the MPN device object.

The same listener can be added to several different MPN device objects.

Lifecycle A listener can be added at any time. A call to add a listener already present will be ignored.

Implementation

void addListener(MpnDeviceListener listener) {
  if (!_listeners.contains(listener)) {
    _listeners.add(listener);
    scheduleMicrotask(() {
      listener.onListenStart();
    });
  }
}