2024-04-20 23:20:52 +00:00
|
|
|
import 'package:flutter/foundation.dart';
|
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
|
|
|
|
import 'cw_mweb_platform_interface.dart';
|
|
|
|
|
|
|
|
/// An implementation of [CwMwebPlatform] that uses method channels.
|
|
|
|
class MethodChannelCwMweb extends CwMwebPlatform {
|
|
|
|
/// The method channel used to interact with the native platform.
|
|
|
|
@visibleForTesting
|
|
|
|
final methodChannel = const MethodChannel('cw_mweb');
|
|
|
|
|
|
|
|
@override
|
2024-04-21 11:19:44 +00:00
|
|
|
Future<int?> start(String dataDir) async {
|
|
|
|
final result = await methodChannel.invokeMethod<int>('start', {'dataDir': dataDir});
|
2024-04-20 23:20:52 +00:00
|
|
|
return result;
|
|
|
|
}
|
2024-07-26 19:34:11 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
Future<void> stop() async {
|
|
|
|
await methodChannel.invokeMethod<void>('stop');
|
|
|
|
}
|
2024-04-20 23:20:52 +00:00
|
|
|
}
|