VoiceSearchController class

Controller for managing voice search functionality

Inheritance

Constructors

VoiceSearchController({String? localeId, void onResult(String text, bool isFinal)?, void onError(String error)?, Duration listenFor = const Duration(seconds: 30), Duration pauseFor = const Duration(seconds: 3)})

Properties

availableLocales List<LocaleName>
Available locales for speech recognition
no setter
currentLocale String
The current locale being used
no setter
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
hasPermission bool
Whether microphone permission is granted
no setter
isAvailable bool
Whether speech recognition is available on this device
no setter
isInitialized bool
Whether the speech recognition is initialized
no setter
isListening bool
Whether speech recognition is currently listening
no setter
isPermanentlyDenied bool
Whether microphone permission is permanently denied
no setter
lastWords String
The last recognized words
no setter
listenFor Duration
Maximum duration to listen for speech
final
localeId String?
The locale to use for speech recognition (e.g., 'en_US', 'ar_SA')
final
onError → void Function(String error)?
Callback when an error occurs
final
onResult → void Function(String text, bool isFinal)?
Callback when speech recognition produces a result
final
pauseFor Duration
Duration of silence before stopping
final
permissionStatus PermissionStatus
The current microphone permission status
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
cancel() Future<void>
Cancel speech recognition
checkPermission() Future<PermissionStatus>
Check current microphone permission status
dispose() → void
Discards any resources used by the object. After this is called, the object is not in a usable state and should be discarded (calls to addListener will throw after the object is disposed).
override
initialize() Future<bool>
Initialize speech recognition This will automatically request microphone permission if not granted
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
openSettings() Future<bool>
Open app settings (useful when permission is permanently denied)
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
requestPermission() Future<PermissionStatus>
Request microphone permission
setLocale(String localeId) → void
Change the locale for speech recognition
startListening() Future<void>
Start listening for speech
stopListening() Future<void>
Stop listening for speech
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited