Has anyone implemented Speech to text inside a textfield in flutter? I found this plugin but I cant get the example to run. I am using VSCode on windows for this build.
I tried this plugin - speech_recognition 0.3.0+1
A few small quirks with that plugin/sample:
_speech.setErrorHandler(errorHandler);Otherwise, it is working. So for some simple testing, all you have to do is convert the Text that it uses to display the speech-to-text results to a TextField. This means changing these two lines and initState():
child: new Text(transcription))),
void onRecognitionResult(String text) => setState(() => transcription = text);
To accomodate a TextField with a controller:
TextEditingController _textEditingController;
@override
initState() {
super.initState();
activateSpeechRecognizer();
_textEditingController = new TextEditingController();
}
child: new TextField(controller: _textEditingController))),
void onRecognitionResult(String text) => setState(() => _textEditingController.text = text);
That’s it. Modify as needed.