diff --git a/ios/Classes/SwiftFlutterTtsPlugin.swift b/ios/Classes/SwiftFlutterTtsPlugin.swift index 7b18a353..b67a8260 100644 --- a/ios/Classes/SwiftFlutterTtsPlugin.swift +++ b/ios/Classes/SwiftFlutterTtsPlugin.swift @@ -501,6 +501,11 @@ extension AVSpeechSynthesisVoiceGender { return "female" case .unspecified: return "unspecified" + @unknown default: + // AVSpeechSynthesisVoiceGender is an Objective-C enum, so a voice + // can report a case this build was not compiled against. Without + // this the switch traps and takes the whole app down. + return "unspecified" } } } diff --git a/macos/Classes/FlutterTtsPlugin.swift b/macos/Classes/FlutterTtsPlugin.swift index f30bca60..09cc9789 100644 --- a/macos/Classes/FlutterTtsPlugin.swift +++ b/macos/Classes/FlutterTtsPlugin.swift @@ -406,6 +406,11 @@ extension AVSpeechSynthesisVoiceGender { return "female" case .unspecified: return "unspecified" + @unknown default: + // AVSpeechSynthesisVoiceGender is an Objective-C enum, so a voice + // can report a case this build was not compiled against. Without + // this the switch traps and takes the whole app down. + return "unspecified" } } }