flutter_jc_printer_plugin/lib/jc_printer_method_channel.dart
2023-10-20 17:45:24 +08:00

24 lines
709 B
Dart

import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'jc_printer_platform_interface.dart';
/// An implementation of [JcPrinterPlatform] that uses method channels.
class MethodChannelJcPrinter extends JcPrinterPlatform {
/// The method channel used to interact with the native platform.
@visibleForTesting
final methodChannel = const MethodChannel('jc_printer');
@override
Future<String?> getPlatformVersion() async {
final version = await methodChannel.invokeMethod<String>('getPlatformVersion');
return version;
}
@override
void connect() async {
final result = await methodChannel.invokeMethod<String>('connect');
print(result);
}
}