ModelEvaluation.fromJson constructor

ModelEvaluation.fromJson(
  1. Object? j
)

Implementation

factory ModelEvaluation.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return ModelEvaluation(
    name: switch (json['name']) {
      null => '',
      Object $1 => decodeString($1),
    },
    displayName: switch (json['displayName']) {
      null => '',
      Object $1 => decodeString($1),
    },
    metricsSchemaUri: switch (json['metricsSchemaUri']) {
      null => '',
      Object $1 => decodeString($1),
    },
    metrics: switch (json['metrics']) {
      null => null,
      Object $1 => protobuf.Value.fromJson($1),
    },
    createTime: switch (json['createTime']) {
      null => null,
      Object $1 => protobuf.Timestamp.fromJson($1),
    },
    sliceDimensions: switch (json['sliceDimensions']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"sliceDimensions" is not a list'),
    },
    modelExplanation: switch (json['modelExplanation']) {
      null => null,
      Object $1 => ModelExplanation.fromJson($1),
    },
    explanationSpecs: switch (json['explanationSpecs']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1)
          ModelEvaluation_ModelEvaluationExplanationSpec.fromJson(i),
      ],
      _ => throw const FormatException('"explanationSpecs" is not a list'),
    },
    metadata: switch (json['metadata']) {
      null => null,
      Object $1 => protobuf.Value.fromJson($1),
    },
    biasConfigs: switch (json['biasConfigs']) {
      null => null,
      Object $1 => ModelEvaluation_BiasConfig.fromJson($1),
    },
  );
}