ServerVad.fromJson constructor

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

Creates from JSON.

Implementation

factory ServerVad.fromJson(Map<String, dynamic> json) {
  if (json['type'] != 'server_vad') {
    throw FormatException(
      'ServerVad.fromJson expected type "server_vad", got ${json['type']}',
    );
  }
  return ServerVad(
    createResponse: json['create_response'] as bool?,
    idleTimeoutMs: json['idle_timeout_ms'] as int?,
    interruptResponse: json['interrupt_response'] as bool?,
    prefixPaddingMs: json['prefix_padding_ms'] as int?,
    silenceDurationMs: json['silence_duration_ms'] as int?,
    threshold: (json['threshold'] as num?)?.toDouble(),
  );
}