Flutter 乌尔都语颤音中的文字语音转换

Flutter 乌尔都语颤音中的文字语音转换,flutter,Flutter,我在应用程序中使用flutter-tts将乌尔都语文本转换为乌尔都语语音,但软件包不支持该语言。我有什么办法可以做到这一点吗 void trans() async { await translator.translate(lang.text, to: 'ur') .then((output) { setState(() { out = output .toString(); //placing the translat

我在应用程序中使用flutter-tts将乌尔都语文本转换为乌尔都语语音,但软件包不支持该语言。我有什么办法可以做到这一点吗

void trans() async {
    await translator.translate(lang.text, to: 'ur') 
        .then((output) {
      setState(() {
        out = output
            .toString(); //placing the translated text to the String to be used
      });
    });
    print(out);
    flutterTts.setLanguage("ur-PK");
    await flutterTts.speak(out);
  }
导入“包装:颤振/材料.省道”;
导入“包:tts/tts.dart”;
void main()=>runApp(TextToSpeech());
TextEditingController=新的TextEditingController();
类TextToSpeech扩展了无状态小部件{
@凌驾
小部件构建(构建上下文){
返回材料PP(
debugShowCheckedModeBanner:false,
家:脚手架(
appBar:appBar(
标题:文本(“文本到语音”),
),
正文:中(
子:列(
mainAxisAlignment:mainAxisAlignment.center,
儿童:[
填充物(
填充:常数边集全部(25.0),
子项:TextFormField(
textAlign:textAlign.center,
控制器:控制器,
),
),
升起的按钮(
儿童:文本(“说话”),
记者:说,
),
],
),
),
),
);
}
}
speak()异步{
Tts.speak(controller.text);
Tts.setLanguage(“ur-PK”);
}

虽然这段代码可以解决这个问题,但如何以及为什么解决这个问题将真正有助于提高您的帖子质量,并可能导致更多的投票。请记住,你是在将来回答读者的问题,而不仅仅是现在提问的人。请在回答中添加解释,并说明适用的限制和假设。
import 'package:flutter/material.dart';
import 'package:tts/tts.dart';

void main() => runApp(TextToSpeech());

TextEditingController controller = new TextEditingController();

class TextToSpeech extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
  debugShowCheckedModeBanner: false,
  home: Scaffold(
    appBar: AppBar(
      title: Text("Text to Speech"),
    ),
    body: Center(
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: <Widget>[
          Padding(
            padding: const EdgeInsets.all(25.0),
            child: TextFormField(
              textAlign: TextAlign.center,
              controller: controller,
            ),
          ),
          RaisedButton(
            child: Text("SPEAK"),
            onPressed: speak,
          ),
        ],
      ),
    ),
  ),
);
}
}

speak() async {
Tts.speak(controller.text);
Tts.setLanguage('ur-PK');
}