Windows MissingPluginException on speak, setSpeechRate, awaitSpeakCompletion
🐛 Bug Report
I had to recently switch from a web app to a Windows app. FlutterTts no longer works as all actions are throwing MissingPluginExceptions.
This is the widget that I am using.
class AudioCue extends StatefulWidget {
const AudioCue({required this.text, Key? key}) : super(key: key);
final String text;
@override
State<AudioCue> createState() => _AudioCueState();
}
class _AudioCueState extends State<AudioCue> {
FlutterTts flutterTts = FlutterTts();
@override
void initState() {
super.initState();
_setAwaitOptions();
}
Future _setAwaitOptions() async {
await flutterTts.awaitSpeakCompletion(true);
}
void _speak(String text) async {
try {
devtools.log(text);
await flutterTts.speak(text);
} catch (e) {
devtools.log(e.toString());
}
}
void _slowSpeak(String text) async {
flutterTts.setSpeechRate(0.1);
try {
await flutterTts.speak(text);
} catch (e) {
// print(e);
}
flutterTts.setSpeechRate(0.5);
// if (result == 1) setState(() => ttsState = TtsState.playing);
}
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(left: 8.0),
child: InkWell(
onTap: () => _speak(widget.text),
onDoubleTap: () => _slowSpeak(widget.text),
child: const Icon(
Icons.volume_up,
size: 40.0,
),
),
);
}
}
Expected behavior
It should speak on tap and speak at a slower speed on double-tap. It worked properly for Flutter Web but has broken down for Flutter Windows.
Configuration
Flutter 3.0.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 676cefaaff (9 days ago) • 2022-06-22 11:34:49 -0700
Engine • revision ffe7b86a1e
Tools • Dart 2.17.5 • DevTools 2.12.2
Version: flutter_tts: ^3.3.3
As for the reference to issue #321, I have both C++ ATL for latest v142 build tools and v143 installed.
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.0.3, on Microsoft Windows [Version 10.0.19044.1766], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[√] Chrome - develop for the web
[√] Visual Studio - develop for Windows (Visual Studio Community 2022 17.2.5)
[√] Android Studio (version 2021.1)
[√] IntelliJ IDEA Ultimate Edition (version 2021.3)
[√] VS Code (version 1.68.1)
[√] Connected device (3 available)
[√] HTTP Host Availability
Platform:
- [ ] 🪟 Windows Desktop
@shirsho-12 Which plugins are missing? Could you copy the error messages?