RealtimeTranslationSessionClosedEvent.fromJson constructor

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

Creates from JSON.

Implementation

factory RealtimeTranslationSessionClosedEvent.fromJson(
  Map<String, dynamic> json,
) {
  if (json['type'] != 'session.closed') {
    throw FormatException(
      'RealtimeTranslationSessionClosedEvent.fromJson expected type '
      '"session.closed", got ${json['type']}',
    );
  }
  return RealtimeTranslationSessionClosedEvent(
    eventId: json['event_id'] as String,
  );
}