[update] use aliyun andriod sdk

This commit is contained in:
2025-08-15 09:37:53 +08:00
parent 24a3a6bd62
commit 1302cd34a9
4 changed files with 93 additions and 66 deletions

23
lib/utils/tts_util.dart Normal file
View File

@@ -0,0 +1,23 @@
import 'package:flutter/services.dart';
class TtsUtil {
static const MethodChannel _channel =
MethodChannel('com.example.ai_chat_assistant/tts');
static Future<T?> execute<T>(String method,
[Map<Object, Object>? arguments]) {
return _channel.invokeMethod(method, arguments);
}
static Future<bool> start(bool isChinese) async {
return await execute('start', {'isChinese': isChinese});
}
static Future<void> send(String text) async {
await execute('send', {'text': text});
}
static Future<void> stopTts() async {
await execute('stop');
}
}