新增plugin flutter_vosk_wakeword

This commit is contained in:
2025-09-27 21:01:20 +08:00
parent f5699fd144
commit f3ff75c437
23 changed files with 459 additions and 3 deletions

View File

@@ -0,0 +1,8 @@
import 'flutter_vosk_wakeword_platform_interface.dart';
class FlutterVoskWakeword {
Future<String?> getPlatformVersion() {
return FlutterVoskWakewordPlatform.instance.getPlatformVersion();
}
}

View File

@@ -0,0 +1,19 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'flutter_vosk_wakeword_platform_interface.dart';
/// An implementation of [FlutterVoskWakewordPlatform] that uses method channels.
class MethodChannelFlutterVoskWakeword extends FlutterVoskWakewordPlatform {
/// The method channel used to interact with the native platform.
@visibleForTesting
final methodChannel = const MethodChannel('flutter_vosk_wakeword');
@override
Future<String?> getPlatformVersion() async {
final version = await methodChannel.invokeMethod<String>('getPlatformVersion');
return version;
}
}

View File

@@ -0,0 +1,29 @@
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
import 'flutter_vosk_wakeword_method_channel.dart';
abstract class FlutterVoskWakewordPlatform extends PlatformInterface {
/// Constructs a FlutterVoskWakewordPlatform.
FlutterVoskWakewordPlatform() : super(token: _token);
static final Object _token = Object();
static FlutterVoskWakewordPlatform _instance = MethodChannelFlutterVoskWakeword();
/// The default instance of [FlutterVoskWakewordPlatform] to use.
///
/// Defaults to [MethodChannelFlutterVoskWakeword].
static FlutterVoskWakewordPlatform get instance => _instance;
/// Platform-specific implementations should set this with their own
/// platform-specific class that extends [FlutterVoskWakewordPlatform] when
/// they register themselves.
static set instance(FlutterVoskWakewordPlatform instance) {
PlatformInterface.verifyToken(instance, _token);
_instance = instance;
}
Future<String?> getPlatformVersion() {
throw UnimplementedError('platformVersion() has not been implemented.');
}
}