events method
Setup a EventChannel to the native side for a window identified by key
.
The creatorKey
is used as a unique value for each instance of a window,
to ensure the right engine is linking up to the right event channel.
Should default to the current window's key.
Implementation
@override
Stream<DataEvent> events(String key, String creatorKey) {
if (!_eventChannels.containsKey(key)) {
_eventChannels[key] = EventChannel('multi_window_linux/events/$key');
_eventStreams[key] = _eventChannels[key]!
.receiveBroadcastStream('$creatorKey/$key')
.map(DataEvent.fromMap);
}
return _eventStreams[key]!;
}