The speech-to-text functionality in my Flutter web application is experiencing inconsistency issues on mobile browsers. While it works fine on desktop browsers, clicking the mic button in the mobile browser sometimes recognizes speech but fails most of the time.
Attempted Solutions: I ensured stable network connectivity, restarted the Flutter application and development server, updated Flutter and Dart SDKs, checked for firewall and proxy settings, and tested on different mobile devices and emulators.
_speechToText.listen(
onResult: (result) {
print('Speech to text result: ${result.recognizedWords}');
_text = result.recognizedWords;
data.text = result.recognizedWords;
textData(result.recognizedWords);
print('finalResult : ${result.finalResult}');
if (result.finalResult) {
chatDataList
.add(ChatData(user: textData.value, bot: '', isUser: true));
}
_restartListeningTimer();
},
listenFor: const Duration(minutes: 15),
);
_restartListeningTimer();
} else {
print('Speech to text not available');
}
} else {
print('Stopping listening...');
setState(() {
_isListening(false);
});
_speechToText.stop();
}