CapacityAdviceResponse.fromJson constructor

CapacityAdviceResponse.fromJson(
  1. Object? j
)

Implementation

factory CapacityAdviceResponse.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return CapacityAdviceResponse(
    recommendations: switch (json['recommendations']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) CapacityAdviceResponseRecommendation.fromJson(i),
      ],
      _ => throw const FormatException('"recommendations" is not a list'),
    },
  );
}