import 'dart:js' as js; final ifCurEnvIsShell = js.context.hasProperty('FisShellApi'); final _shellApi = ifCurEnvIsShell ? js.context['FisShellApi'] as js.JsObject : js.JsObject(js.context['Object']); js.JsObject callShellMethod(String method, List? args) { if (ifCurEnvIsShell) { return _shellApi.callMethod(method, args ?? []); } else { return js.JsObject(js.context['Object']); } } /// JS call Shell 方法,触发 Shell 的切割面计算,会返回一个 Promise 对象回到 JS 上下文,再触发 threejs 内的切割事件 js.JsObject callShellGetClipPlaneData(msg) { // debugPrint('webview 触发 Dart_getClipPlaneData :$msg'); return callShellMethod('getClipPlaneData', [msg]); } /// JS call Shell 方法,获取 AI 切割面 js.JsObject callShellGetVesselClipPlanePoints(msg) { return callShellMethod('getVesselClipPlanePoints', []); } /// JS call Shell 方法,切换测量模式 即转 颈动脉 2D 测量 js.JsObject callShellSwitchMeasureMode(res, imageAdjustPara) => callShellMethod("switchMeasureMode", [res, imageAdjustPara.toJson()]);