ExplainResponse.fromJson constructor
ExplainResponse.fromJson(
- Object? j
Implementation
factory ExplainResponse.fromJson(Object? j) {
final json = j as Map<String, Object?>;
return ExplainResponse(
explanations: switch (json['explanations']) {
null => [],
List<Object?> $1 => [for (final i in $1) Explanation.fromJson(i)],
_ => throw const FormatException('"explanations" is not a list'),
},
concurrentExplanations: switch (json['concurrentExplanations']) {
null => {},
Map<String, Object?> $1 => {
for (final e in $1.entries)
decodeString(e.key): ExplainResponse_ConcurrentExplanation.fromJson(
e.value,
),
},
_ => throw const FormatException(
'"concurrentExplanations" is not an object',
),
},
deployedModelId: switch (json['deployedModelId']) {
null => '',
Object $1 => decodeString($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'),
},
);
}