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

Description

Manages the full on-device speech recognition session lifecycle using Flutter's speech_to_text plugin (wrapping iOS Speech framework and Android SpeechRecognizer). Emits BLoC events for interim and final transcription results consumed by active form widgets. Handles microphone permission, language fallback, and session error recovery.

Feature: Speech-to-Text Input

speech-to-text-service

Responsibilities

  • Request microphone permission lazily on first use with a clear purpose string
  • Initialize and manage the speech_to_text plugin session (start, interim results, final result, timeout, error)
  • Emit SpeechStarted, SpeechInterim, SpeechFinal, SpeechError, and SpeechStopped BLoC events
  • Detect device language and fall back to Norwegian recognition when Sami locale is active, emitting a fallback notice event
  • Enforce post-activity-only constraint - refuse to start a session if the active screen context is not a registration or notes form

Interfaces

initialize(): Future<bool>
requestPermission(): Future<PermissionStatus>
startListening(locale: String): void
stopListening(): void
cancelListening(): void
isAvailable(): bool
isListening(): bool
getSupportedLocales(): List<LocaleName>
dispose(): void

Relationships

Dependents (1)

Components that depend on this component