QueryCorpusResponse.fromJson constructor

QueryCorpusResponse.fromJson(
  1. Object? j
)

Implementation

factory QueryCorpusResponse.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return QueryCorpusResponse(
    relevantChunks: switch (json['relevantChunks']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) RelevantChunk.fromJson(i)],
      _ => throw const FormatException('"relevantChunks" is not a list'),
    },
  );
}