onWindowEvent method

void onWindowEvent(
  1. String windowId,
  2. String eventName,
  3. void callback(
    1. NativeEvent
    )
)

Subscribe to events for a specific window.

Implementation

void onWindowEvent(
  String windowId,
  String eventName,
  void Function(NativeEvent) callback,
) {
  void handler(NativeEvent event) {
    if (event.event == eventName && event.windowId == windowId) {
      callback(event);
    }
  }

  _subscriptions.add(handler);
  _bridge.subscribe(serviceName, handler);
}