RealtimeTranslationOutputTranscriptDeltaEvent.fromJson constructor

RealtimeTranslationOutputTranscriptDeltaEvent.fromJson(
  1. Map<String, dynamic> json
)

Creates from JSON.

Implementation

factory RealtimeTranslationOutputTranscriptDeltaEvent.fromJson(
  Map<String, dynamic> json,
) {
  if (json['type'] != 'session.output_transcript.delta') {
    throw FormatException(
      'RealtimeTranslationOutputTranscriptDeltaEvent.fromJson expected type '
      '"session.output_transcript.delta", got ${json['type']}',
    );
  }
  return RealtimeTranslationOutputTranscriptDeltaEvent(
    eventId: json['event_id'] as String,
    delta: json['delta'] as String,
    elapsedMs: json['elapsed_ms'] as int?,
  );
}