setVoiceSpeed method

Future<void> setVoiceSpeed(
  1. double speed
)

Playback speed of the voice queue — guidance sentences and enqueueVoice clips alike. 1.0 is the natural speed; the value is clamped to 0.5..2.0 and applies from the next item.

Implementation

Future<void> setVoiceSpeed(double speed) async {
  final value = speed.isNaN ? 1.0 : speed.clamp(0.5, 2.0).toDouble();
  try {
    await _methodChannel
        .invokeMethod<void>(MethodChannelEvent.setVoiceSpeed, {'speed': value});
  } on PlatformException catch (e) {
    log('setVoiceSpeed error: ${e.message}');
  } on MissingPluginException catch (e) {
    log('setVoiceSpeed error: ${e.message}');
  }
}