dlutton / flutter_tts

Flutter Text to Speech package
MIT License
617 stars 258 forks source link

Unhandled Exception: MissingPluginException(No implementation found for method setEngine on channel flutter_tts) #496

Open minh-dai opened 6 months ago

minh-dai commented 6 months ago

🐛 Bug Report

I just run the example project on my iPhone

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: MissingPluginException(No implementation found for method setEngine on channel flutter_tts)

0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:332:7)

#1 FlutterTts.setEngine (package:flutter_tts/flutter_tts.dart:454:5) #2 TTSModule.changedEnginesDropDownItem (package:tts/tts.dart:333:5) **Version:** flutter 3.19.6 **Platform:** - [ ] :iphone: iOS 17.4.1 - [ ] :robot: Android
echogit commented 5 months ago

There is no engine selection in IOS, that's why you have this exception, it is kind of expected.

DevanshiGor commented 3 months ago

same issue here, what is solution for iOS then?

echogit commented 2 months ago

same issue here, what is solution for iOS then?

As I said above, you need to check if you are on iOS and to not call this method.

Such as:

import 'dart:io' 
...
if (Platform.isAndroid) 
{ 
      // Android-specific code, such as using setEngine 
} 
else if (Platform.isIOS) { 
     // iOS-specific code 
}