clearActiveSttIdentity method

  1. @override
Future<void> clearActiveSttIdentity()
override

Clears the active STT identity (in-memory spec + persisted prefs).

See clearActiveInferenceIdentity: default throws rather than silently no-op'ing, so a non-overriding implementer fails loudly instead of leaving a stale persisted identity.

Implementation

@override
Future<void> clearActiveSttIdentity() async {
  await _ensureInitialized();
  try {
    final prefs = await SharedPreferences.getInstance();
    await prefs.remove(PreferencesKeys.activeSttFilename);
    await prefs.remove(PreferencesKeys.activeSttTokenizerFilename);
    await prefs.remove(PreferencesKeys.activeSttModelType);
    await prefs.remove(PreferencesKeys.activeSttSource);
    await prefs.remove(PreferencesKeys.activeSttTokenizerSource);
    _activeSttModel = null;
  } catch (e) {
    gemmaLog('[ModelManager] clearActiveSttIdentity failed: $e');
    rethrow;
  }
  gemmaLog('Active STT identity cleared');
}