elysia/plugin/alive_plugin/lib/alive_plugin_method_channel.dart
2025-11-04 09:53:47 +08:00

24 lines
737 B
Dart

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