You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
809 B
29 lines
809 B
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<void> init() async {
|
|
await methodChannel.invokeMethod<String>('init');
|
|
}
|
|
|
|
@override
|
|
Future<void> startUpgrading({String? address, String? filePath}) async {
|
|
await methodChannel.invokeMethod<String>('startUpgrading', {
|
|
'address': address,
|
|
'filePath': filePath,
|
|
});
|
|
}
|
|
|
|
@override
|
|
Future<void> onOtaClose() async {
|
|
await methodChannel.invokeMethod<String>('onOtaClose');
|
|
}
|
|
}
|
|
|