dlutton / flutter_tts

Flutter Text to Speech package
MIT License
601 stars 250 forks source link

iOS app crashes when speaking different languages quickly and alternately #197

Closed nero-angela closed 3 years ago

nero-angela commented 3 years ago

πŸ› 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

  1. add below code and run
  2. quickly press the two buttons alternately
    
    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
nero-angela commented 3 years ago

In the latest version, the issue does not seem to occur, so I close it.