updateLocale method

Future<void> updateLocale(
  1. String newLocale
)

Implementation

Future<void> updateLocale(String newLocale) async {
  if (newLocale != _localeId) {
    print('Updating locale from $_localeId to $newLocale');

    // Stop current recognition if running
    if (_isMicOn) {
      await stopListening();
    }

    // Update locale
    _localeId = newLocale;

    // Force cleanup of current instance
    await dispose();
    _isInitialized = false;

    // Reinitialize with new locale
    await _initializeWithRetry();
  }
}