cake_wallet/cw_mweb/lib/cw_mweb_method_channel.dart
Matthew Fosse 7b5c36e5a7 wip
2024-09-04 15:50:56 -07:00

32 lines
942 B
Dart

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
Future<int?> start(String dataDir) async {
final result = await methodChannel.invokeMethod<int>('start', {'dataDir': dataDir});
return result;
}
@override
Future<void> stop() async {
await methodChannel.invokeMethod<void>('stop');
}
@override
Future<String?> address(String scanSecret, String spendPub, int index) async {
final result = await methodChannel.invokeMethod<String>('address', {
'scanSecret': scanSecret,
'spendPub': spendPub,
'index': index,
});
return result;
}
}