NetworkEndpoint.fromJson constructor

NetworkEndpoint.fromJson(
  1. Object? j
)

Implementation

factory NetworkEndpoint.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return NetworkEndpoint(
    annotations: switch (json['annotations']) {
      null => {},
      Map<String, Object?> $1 => {
        for (final e in $1.entries)
          decodeString(e.key): decodeString(e.value),
      },
      _ => throw const FormatException('"annotations" is not an object'),
    },
    clientDestinationPort: switch (json['clientDestinationPort']) {
      null => null,
      Object $1 => decodeInt($1),
    },
    fqdn: switch (json['fqdn']) {
      null => null,
      Object $1 => decodeString($1),
    },
    instance: switch (json['instance']) {
      null => null,
      Object $1 => decodeString($1),
    },
    ipAddress: switch (json['ipAddress']) {
      null => null,
      Object $1 => decodeString($1),
    },
    ipv6Address: switch (json['ipv6Address']) {
      null => null,
      Object $1 => decodeString($1),
    },
    port: switch (json['port']) {
      null => null,
      Object $1 => decodeInt($1),
    },
  );
}