SttManager class
SttManager - Speech-to-Text (STT) handler
Handles all Speech-to-Text (STT) functionality including:
- Microphone permission handling
- Starting/stopping speech recognition
- Continuous listening
- Language switching
- Queueing overlapping recognition results
- Deduplicating and safely processing input
This class provides a simple interface to capture voice input from the user and stream it back to the game engine or UI.
Usage Example:
final stt = SttManager();
await stt.initialize();
stt.onResult = (text) async => print('Recognized: $text');
stt.onError = (error) => print('Error: $error');
await stt.startListening(localeId: 'en_US');
Part of the Fifty Flutter Kit.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isAvailable → bool
-
Returns whether the engine is initialized and available
no setter
- isListening → bool
-
Returns whether speech recognition is active
no setter
- isProcessing ↔ bool
-
Whether a result is currently being processed
getter/setter pair
- onError ↔ void Function(String error)?
-
Optional callback for errors
getter/setter pair
-
onResult
↔ Future<
void> Function(String text)? -
Optional callback that receives recognized text
getter/setter pair
- partialResults ↔ bool
-
Whether to emit partial results
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
cancelListening(
) → Future< void> - Cancels listening and discards results
-
dispose(
) → void - Disposes resources and cancels listening
-
flushQueue(
) → void - Clears any queued results manually
-
initialize(
) → Future< bool> - Initializes the STT engine
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
startListening(
{String localeId = 'en_US', bool partialResults = true, bool listenContinuously = true}) → Future< void> - Starts listening and streams recognized text
-
stopListening(
) → Future< void> - Stops listening and finalizes result
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited