CapacityHistoryResponse.fromJson constructor
CapacityHistoryResponse.fromJson(
- Object? j
Implementation
factory CapacityHistoryResponse.fromJson(Object? j) {
final json = j as Map<String, Object?>;
return CapacityHistoryResponse(
location: switch (json['location']) {
null => null,
Object $1 => decodeString($1),
},
machineType: switch (json['machineType']) {
null => null,
Object $1 => decodeString($1),
},
preemptionHistory: switch (json['preemptionHistory']) {
null => [],
List<Object?> $1 => [
for (final i in $1)
CapacityHistoryResponsePreemptionRecord.fromJson(i),
],
_ => throw const FormatException('"preemptionHistory" is not a list'),
},
priceHistory: switch (json['priceHistory']) {
null => [],
List<Object?> $1 => [
for (final i in $1) CapacityHistoryResponsePriceRecord.fromJson(i),
],
_ => throw const FormatException('"priceHistory" is not a list'),
},
);
}