[ Flutter ] TTS
pubspec.yaml
dependencies:
flutter:
sdk: flutter
flutter_tts: ^3.1.0 # Replace with the latest version
android/app/src/main/AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.app_name">
...
<uses-permission android:name="android.permission.INTERNET"/>
...
</manifest>
ios/Runner/Info.plist
<key>NSMicrophoneUsageDescription</key>
<string>We need your microphone access to enable speech synthesis</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
main.dart
import 'package:flutter/material.dart';
import 'package:your_app/your_app.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
runApp(MyApp());
}
에러
MissingPluginException ... No implementation found for method setLanugae on channel flutter__tts
해결책
main.dart 다시빌드한다
혹은
flutter clean
flutter pub get
[ Speak to TTs]
pubspec.yaml
dependencies:
flutter:
sdk: flutter
flutter_tts: ^3.4.0
speech_to_text: ^5.2.1
AndroidManifest.xml 파일에 권한 추가
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.your_app">
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.INTERNET"/>
<application
android:label="your_app"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
Info.plist
<key>NSMicrophoneUsageDescription</key>
<string>We need your microphone to recognize your speech.</string>
<key>NSSpeechRecognitionUsageDescription</key>
<string>We need your permission to use speech recognition.</string>

