RealtimeTranslationSessionUpdatedEvent.fromJson constructor

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

Creates from JSON.

Implementation

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