import 'package:flutter/foundation.dart'; import 'package:flutter/services.dart'; import 'ota_platform_interface.dart'; /// An implementation of [OtaPlatform] that uses method channels. class MethodChannelOta extends OtaPlatform { /// The method channel used to interact with the native platform. @visibleForTesting final methodChannel = const MethodChannel('ota'); @override Future startUpgrading(String? filePath) async { final version = await methodChannel.invokeMethod( 'startUpgrading', {'filePath': filePath}, // 传递参数 ); return version; } @override Future onOtaClose() async { final version = await methodChannel.invokeMethod('onOtaClose'); return version; } }