On-device speech recognition, with a speech_to_text-backed implementation. Part of the modular-flutter-template core modules.
Two packages:
speech_api— the abstract contract:SpeechRecognizerApi, the sealedSpeechAvailabilityandSpeechResult. Feature code and other_apipackages depend on this, never onspeech_impl.speech_impl— the concrete implementation overspeech_to_text, andSpeechModule. Only the app's composition root depends on this.
Workspace packages: depend on them by name, with no source:
dependencies:
speech_api:
speech_impl: # the app's composition root onlyThe host app still owns the platform setup speech_to_text needs: the
microphone and speech-recognition usage descriptions in Info.plist, and the
RECORD_AUDIO permission in AndroidManifest.xml.
Resolved with the rest of the workspace: run flutter pub get at the repo
root. Tests run with the others through dart run melos test.
Speech recognition needs a physical device; the iOS Simulator cannot do it reliably, so the tests here cover only the platform-free parts.