PredictResponse.fromJson constructor

PredictResponse.fromJson(
  1. Object? j
)

Implementation

factory PredictResponse.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return PredictResponse(
    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'),
    },
    deployedModelId: switch (json['deployedModelId']) {
      null => '',
      Object $1 => decodeString($1),
    },
    model: switch (json['model']) {
      null => '',
      Object $1 => decodeString($1),
    },
    modelVersionId: switch (json['modelVersionId']) {
      null => '',
      Object $1 => decodeString($1),
    },
    modelDisplayName: switch (json['modelDisplayName']) {
      null => '',
      Object $1 => decodeString($1),
    },
    metadata: switch (json['metadata']) {
      null => null,
      Object $1 => protobuf.Value.fromJson($1),
    },
  );
}