Closed nero-angela closed 3 years ago
iOS app crashes when speaking different languages quickly and alternately
When running with the flutter project, the error log was not output, so it was run with xcode.
https://user-images.githubusercontent.com/26322627/105464974-b20e4080-5cd5-11eb-9725-108d3dda42f4.mp4
import 'package:flutter/material.dart'; import 'package:flutter_tts/flutter_tts.dart';
void main() { runApp(MyApp()); }
class MyApp extends StatefulWidget { MyApp({Key key}) : super(key: key);
@override _MyAppState createState() => _MyAppState(); }
class _MyAppState extends State { final FlutterTts tts = FlutterTts(); String currentLanguage;
@override void initState() { super.initState(); }
void speak(String text, String lang) async { if (currentLanguage != lang) { await tts.setLanguage(lang); currentLanguage = lang; } tts.speak(lang); }
@override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( body: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.stretch, children: [ RaisedButton( onPressed: () => speak('hello world', 'en-US'), child: Text('speak english'), ), RaisedButton( onPressed: () => speak('μλ νμΈμ', 'ko-KR'), child: Text('speak korean'), ), ], ), ), ); } }
### Configuration **Version:** 2.1.0 **Platform:** - [x] :iphone: iOS - [ ] :robot: Android
In the latest version, the issue does not seem to occur, so I close it.
π Bug Report
iOS app crashes when speaking different languages quickly and alternately
When running with the flutter project, the error log was not output, so it was run with xcode.
https://user-images.githubusercontent.com/26322627/105464974-b20e4080-5cd5-11eb-9725-108d3dda42f4.mp4
Reproduction steps
void main() { runApp(MyApp()); }
class MyApp extends StatefulWidget { MyApp({Key key}) : super(key: key);
@override _MyAppState createState() => _MyAppState(); }
class _MyAppState extends State {
final FlutterTts tts = FlutterTts();
String currentLanguage;
@override void initState() { super.initState(); }
void speak(String text, String lang) async { if (currentLanguage != lang) { await tts.setLanguage(lang); currentLanguage = lang; } tts.speak(lang); }
@override Widget build(BuildContext context) { return MaterialApp( home: Scaffold( body: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.stretch, children: [ RaisedButton( onPressed: () => speak('hello world', 'en-US'), child: Text('speak english'), ), RaisedButton( onPressed: () => speak('μλ νμΈμ', 'ko-KR'), child: Text('speak korean'), ), ], ), ), ); } }