Now, we will add speech recognition to the application so that it can listen to the user's queries and act accordingly.
We will be using the speech_recognition plugin here. Let's add the dependency, as follows:
- Add the dependency to the pubspec.yaml file, like so:
- Get the packages by running the following command-line argument:
flutter packages get
- Now, since we are using the microphone of the device, we need to ask for the user's permission. To do this, we need to add the following lines of code:
On iOS, permissions are specified inside infos.plist: