RealtimeTranslationSessionUpdateEvent.fromJson constructor
Creates from JSON.
Implementation
factory RealtimeTranslationSessionUpdateEvent.fromJson(
Map<String, dynamic> json,
) {
if (json['type'] != 'session.update') {
throw FormatException(
'RealtimeTranslationSessionUpdateEvent.fromJson expected type '
'"session.update", got ${json['type']}',
);
}
if (json['session'] == null) {
throw const FormatException(
'RealtimeTranslationSessionUpdateEvent.fromJson missing required '
'"session" field',
);
}
return RealtimeTranslationSessionUpdateEvent(
session: RealtimeTranslationSessionUpdateRequest.fromJson(
json['session'] as Map<String, dynamic>,
),
eventId: json['event_id'] as String?,
);
}