import 'package:flutter/services.dart';

class TtsUtil {
  static const MethodChannel _channel =
      MethodChannel('com.example.ai_chat_assistant/ali_sdk');

  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('startTts', {'isChinese': isChinese});
  }

  static Future<void> send(String text) async {
    await execute('sendTts', {'text': text});
  }

  static Future<void> complete() async {
    await execute('completeTts');
  }

  static Future<void> stop() async {
    await execute('stopTts');
  }
}
