Service Layer medium complexity mobile
1
Dependencies
2
Dependents
0
Entities
0
Integrations

Description

Manages the full lifecycle of speech recognition by delegating to the Flutter speech_to_text plugin, which invokes native platform APIs (iOS SpeechRecognizer, Android SpeechRecognizer) for on-device transcription. Handles microphone permission requests, language selection (defaulting to Norwegian Bokmål), error recovery for recognition failures, and graceful degradation on devices without speech support. No audio is stored or transmitted — all processing is on-device.

Feature: Speech-to-Text Input for Reports

speech-recognition-service

Responsibilities

  • Request and manage microphone runtime permissions
  • Initialize and configure the speech_to_text plugin for the target locale
  • Stream partial and final transcription results to the widget layer
  • Handle recognition errors with recovery strategies and user-facing messages
  • Detect device capability and expose availability flag for graceful degradation

Interfaces

initialize() → Future<bool>
isAvailable → bool
hasPermission → bool
requestPermission() → Future<bool>
startListening({required Function(String) onResult, String locale = 'nb_NO'}) → Future<void>
stopListening() → Future<void>
cancelListening() → Future<void>
isListening → bool
availableLocales() → Future<List<LocaleName>>
setLocale(String localeId) → void
lastError → SpeechRecognitionError?

Relationships

Dependencies (1)

Components this component depends on

Dependents (2)

Components that depend on this component