RealtimeTranslationErrorEvent.fromJson constructor

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

Creates from JSON.

Implementation

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