initialize method
Initializes the STT engine
Returns true if speech recognition is available on the device.
Implementation
Future<bool> initialize() async {
_isAvailable = await _speech.initialize(
onError: (error) => onError?.call(error.errorMsg),
onStatus: (status) {
if (status == 'done' || status == 'notListening') {
_isListening = false;
}
},
);
return _isAvailable;
}