handleMethodCall method

  1. @visibleForTesting
Future handleMethodCall(
  1. MethodCall call
)

Implementation

@visibleForTesting
Future<dynamic> handleMethodCall(MethodCall call) async {
  switch (call.method) {
    case 'recreateEventChannel':
      logInfo(
        'YOLOView: Platform requested recreation of event channel for $_viewId',
      );
      _cancelResultSubscription();
      _recreateTimer?.cancel();
      _recreateTimer = Timer(const Duration(milliseconds: 100), () {
        if (mounted &&
            (widget.onResult != null ||
                widget.onPerformanceMetrics != null)) {
          _subscribeToResults();
          logInfo('YOLOView: Event channel recreated for $_viewId');
        }
      });
      return null;
    case 'onZoomChanged':
      final zoomLevel = call.arguments as double?;
      if (zoomLevel != null && widget.onZoomChanged != null) {
        logInfo('YoloView: Zoom level changed to $zoomLevel');
        widget.onZoomChanged!(zoomLevel);
      }
      return null;
    default:
      logInfo('YOLOView: Unknown method call: ${call.method}');
      return null;
  }
}