RealtimeTranslationSessionCreatedEvent.fromJson constructor

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

Creates from JSON.

Implementation

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