WireGroup.fromJson constructor

WireGroup.fromJson(
  1. Object? j
)

Implementation

factory WireGroup.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return WireGroup(
    adminEnabled: switch (json['adminEnabled']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    creationTimestamp: switch (json['creationTimestamp']) {
      null => null,
      Object $1 => decodeString($1),
    },
    description: switch (json['description']) {
      null => null,
      Object $1 => decodeString($1),
    },
    endpoints: switch (json['endpoints']) {
      null => {},
      Map<String, Object?> $1 => {
        for (final e in $1.entries)
          decodeString(e.key): WireGroupEndpoint.fromJson(e.value),
      },
      _ => throw const FormatException('"endpoints" is not an object'),
    },
    id: switch (json['id']) {
      null => null,
      Object $1 => decodeUint64($1),
    },
    kind: switch (json['kind']) {
      null => null,
      Object $1 => decodeString($1),
    },
    name: switch (json['name']) {
      null => null,
      Object $1 => decodeString($1),
    },
    reconciling: switch (json['reconciling']) {
      null => null,
      Object $1 => decodeBool($1),
    },
    selfLink: switch (json['selfLink']) {
      null => null,
      Object $1 => decodeString($1),
    },
    topology: switch (json['topology']) {
      null => null,
      Object $1 => WireGroupTopology.fromJson($1),
    },
    wireProperties: switch (json['wireProperties']) {
      null => null,
      Object $1 => WireProperties.fromJson($1),
    },
    wires: switch (json['wires']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) Wire.fromJson(i)],
      _ => throw const FormatException('"wires" is not a list'),
    },
  );
}