RealtimeTranslationSessionCloseEvent.fromJson constructor

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

Creates from JSON.

Implementation

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