HealthSourceHealth.fromJson constructor

HealthSourceHealth.fromJson(
  1. Object? j
)

Implementation

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