fix(voice-call): Improve async handling and state management
Refactor voice call service to handle asynchronous operations more precisely. Update method signatures to be async, use unawaited for non-blocking calls, and ensure proper state reset between sessions. Improve error handling and resource management for voice input and text-to-speech services.
This commit is contained in:
@@ -1026,12 +1026,12 @@ class VoiceInputService {
|
||||
});
|
||||
}
|
||||
|
||||
void dispose() {
|
||||
stopListening();
|
||||
unawaited(_disposeVadHandler());
|
||||
unawaited(_microphonePermissionProbe.dispose());
|
||||
Future<void> dispose() async {
|
||||
await stopListening();
|
||||
await _disposeVadHandler();
|
||||
await _microphonePermissionProbe.dispose();
|
||||
try {
|
||||
_speech.stop();
|
||||
await _speech.stop();
|
||||
} catch (_) {}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user