EvaluatedAnnotation.fromJson constructor

EvaluatedAnnotation.fromJson(
  1. Object? j
)

Implementation

factory EvaluatedAnnotation.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return EvaluatedAnnotation(
    type: switch (json['type']) {
      null => EvaluatedAnnotation_EvaluatedAnnotationType.$default,
      Object $1 => EvaluatedAnnotation_EvaluatedAnnotationType.fromJson($1),
    },
    predictions: switch (json['predictions']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) protobuf.Value.fromJson(i)],
      _ => throw const FormatException('"predictions" is not a list'),
    },
    groundTruths: switch (json['groundTruths']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) protobuf.Value.fromJson(i)],
      _ => throw const FormatException('"groundTruths" is not a list'),
    },
    dataItemPayload: switch (json['dataItemPayload']) {
      null => null,
      Object $1 => protobuf.Value.fromJson($1),
    },
    evaluatedDataItemViewId: switch (json['evaluatedDataItemViewId']) {
      null => '',
      Object $1 => decodeString($1),
    },
    explanations: switch (json['explanations']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) EvaluatedAnnotationExplanation.fromJson(i),
      ],
      _ => throw const FormatException('"explanations" is not a list'),
    },
    errorAnalysisAnnotations: switch (json['errorAnalysisAnnotations']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) ErrorAnalysisAnnotation.fromJson(i),
      ],
      _ => throw const FormatException(
        '"errorAnalysisAnnotations" is not a list',
      ),
    },
  );
}