What?
As the name suggests speech to text is process which gives android apps voice maneuvers. This article explains the use of speech to text package rather than “speech_recognition” package which is not supported well in flutter.
Why?
Voice maneuver is better than typing everything manually tediously.
How ?
Step 1
Include the following package in pubspec.yaml file
speech_to_text: ^2.5.0
and run “Flutter pub get “ to build the package inside your app.
Step 2
Change the minimum SDK version to 21 in build grade file of app subfolder of android folder . As speech to text minimum support SDK is 21.
Step 3
Include the following line
import ‘package: speech_to_text/speech_to_text.dart’ as stt;
In the page where you want to speech recognition to be implemented
Step 4
Create a floating action button with mic Symbol . Call the “ _listen” function inside “on pressed “ of floating action button. _listen code is given below.
Step-5
Give it a test.
.
Reference
https://github.com/coeaimrm/flutter_voice/tree/improved(Forked and improved on MarcusNG)
https://www.youtube.com/watch?v=wDWoD1AaLu8&t=103s
Comentarios