Я использую sherp_to_text: ^5.6.1 плагин для речи в текст, он работает нормально на iOS . Но в Android он работает нормально до 3 секунд после того, как запись автоматически останавливается и выбрасывает ошибку ошибки: речевое обнаружение, msg: error_speech_timeout, permanent: true
и в Manifest я включил все необходимые уравновешивания
home.dart
body: SingleChildScrollView(
reverse: true,
padding: const EdgeInsets.all(30).copyWith(bottom: 150),
child: SubstringHighlight(
text: text,
terms: Command.all,
textStyle: TextStyle(
fontSize: 32.0,
color: Colors.black,
fontWeight: FontWeight.w400,
),
textStyleHighlight: TextStyle(
fontSize: 32.0,
color: Colors.red,
fontWeight: FontWeight.w400,
),
),
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
floatingActionButton: AvatarGlow(
animate: isListening,
endRadius: 75,
glowColor: Theme.of(context).primaryColor,
child: FloatingActionButton(
child: Icon(isListening ? Icons.mic : Icons.mic_none, size: 36),
onPressed: toggleRecording,
),
),
speech_api.dart>import 'package:flutter/cupertino.dart';
import 'package:speech_to_text/speech_to_text.dart';
class SpeechApi {
static final _speech = SpeechToText();
static Future toggleRecording({
@required Function(String text) onResult,
@required ValueChanged onListening,
}) async {
if (_speech.isListening) {
_speech.stop();
return true;
}
final isAvailable = await _speech.initialize(
onStatus: (status) => onListening(_speech.isListening),
onError: (e) => print('Error: $e'),
);
if (isAvailable) {
_speech.listen(onResult: (value) => onResult(value.recognizedWords));
}
return isAvailable;
}
}
Подробнее здесь: https://stackoverflow.com/questions/733 ... true-in-fl