import 'dart:async'; import 'dart:io'; import 'package:flutter/services.dart'; class TestPlugin { static const MethodChannel _channel = MethodChannel('test'); /// 获取OpenAI SDK版本信息 static Future getVersion() async { if (Platform.isIOS) { try { final String version = await _channel.invokeMethod('getVersion'); return version; } on PlatformException catch (e) { throw Exception('获取版本失败: ${e.message}'); } } else { throw UnsupportedError('此插件目前仅支持iOS平台'); } } }