onEvent method
Implementation
void onEvent(void Function(Event event) onEvent) {
_onEvent = onEvent;
_attachStreamEventHandlerIfNeeded();
}
void onEvent(void Function(Event event) onEvent) {
_onEvent = onEvent;
_attachStreamEventHandlerIfNeeded();
}