getAudio method

  1. @override
Future<TextToSpeechResponse> getAudio(
  1. String text, {
  2. TextToSpeechOptions? options,
  3. CancellationToken? cancellationToken,
})
override

Synthesizes text into audio and returns the complete response.

Implementation

@override
Future<TextToSpeechResponse> getAudio(
  String text, {
  TextToSpeechOptions? options,
  CancellationToken? cancellationToken,
}) async {
  developer.Timeline.startSync(
    OpenTelemetryConsts.textToSpeechSpanName,
    arguments: _buildArguments(options),
  );
  try {
    final result = await super.getAudio(
      text,
      options: options,
      cancellationToken: cancellationToken,
    );
    developer.Timeline.finishSync();
    return result;
  } catch (e) {
    developer.Timeline.finishSync();
    rethrow;
  }
}