I am working with the flutter text to speech functionality. Later after when I get the text it is sending the text in parts.
I am using the speech_recognition plugin where I input my voice command and the text is sent to one of the API created, but the problem is it sends the text in parts to the API. Example : Actual Text: What time it is but some times the String goes 2 times 2 API calls OR Some times it sends only a few words at a time
_speechRecognition.setAvailabilityHandler((bool result) => setState(() {
_isAvailable = result;
print('Avalibility handler was called');
}));
_speechRecognition.setRecognitionStartedHandler(
() => setState(() {
_isListening = true;
print('recognition start handler was called');
}),
);
_speechRecognition.setRecognitionResultHandler(
(String speech) => setState(() {
resultText = speech;
print(
'set result handler was called This is the result handler : $resultText');
if (_isListening == false && resultText != '') {
_handleSubmitted(speech);
}
}),
);
_speechRecognition.setRecognitionCompleteHandler(() {
setState(() {
print('set recognition complete handler was called');
_isListening = false;
});
});
_speechRecognition.activate().then(
(result) => setState(() {
_isAvailable = result;
print('set activate handler was called');
}),
);
}```