csdcorp / speech_to_text

A Flutter plugin that exposes device specific text to speech recognition capability.
BSD 3-Clause "New" or "Revised" License
372 stars 231 forks source link

Is there a way to listen for changes to SpeechToText.isListening? #538

Closed LampeMW closed 1 month ago

LampeMW commented 1 month ago

I have a button in my app to start/stop the microphone speech to text process. On Android specifically, once the user stops speaking for a short period of time, the OS plays a sound and the listening stops. I would like to listen for this change and be able to automatically update the UI once listening has stopped. Currently I am using a timer and checking _speechToText.isListening every 50ms but I wasn't sure if there was an easier way to listen for this change.

sowens-csd commented 1 month ago

You can use the onStatus listener on the initialize method.

LampeMW commented 1 month ago

Thank you! I totally missed that the initialize method had properties I could use. Thanks again for the quick reply.