onNativeEvent method
Routes a typed native event (zoom/lens/focus) to the matching stream.
Called by YOLOView from its event-channel listener; safe to invoke from other native bridges that surface the
same typed events.
Implementation
void onNativeEvent(Map<dynamic, dynamic> event) {
final type = event['type'];
if (type is! String) return;
switch (type) {
case 'zoom':
final value = (event['value'] as num?)?.toDouble();
if (value != null && !_zoomController.isClosed) {
_zoomController.add(value);
}
break;
case 'lens':
final label = event['label'];
if (label is String && !_lensController.isClosed) {
_lensController.add(label);
}
break;
case 'focus':
final x = (event['x'] as num?)?.toDouble();
final y = (event['y'] as num?)?.toDouble();
if (x != null && y != null && !_focusController.isClosed) {
_focusController.add(Offset(x, y));
}
break;
}
}