flutter tts no sound is playing

Viewed 15

I want to convert text to audio using the tts package, I wrote the following methods and added the necessary code to the manifest file, but when I click the button, the sound does not play.

 IconButton(
        onPressed: () {
                 _speak(words.english!);
                       },
         icon: Icon(Icons.volume_up,
             color: Colors.white)),

final FlutterTts tts = FlutterTts();

Future _speak(String text) async {
    await tts.setLanguage("en-US");
    await tts.setPitch(1);
    await tts.setSpeechRate(0.8);
    await tts.speak(text);
  }
0 Answers
Related