Address.fromJson constructor

Address.fromJson(
  1. Object? j
)

Implementation

factory Address.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return Address(
    address: switch (json['address']) {
      null => null,
      Object $1 => decodeString($1),
    },
    addressType: switch (json['addressType']) {
      null => null,
      Object $1 => decodeString($1),
    },
    creationTimestamp: switch (json['creationTimestamp']) {
      null => null,
      Object $1 => decodeString($1),
    },
    description: switch (json['description']) {
      null => null,
      Object $1 => decodeString($1),
    },
    id: switch (json['id']) {
      null => null,
      Object $1 => decodeUint64($1),
    },
    ipCollection: switch (json['ipCollection']) {
      null => null,
      Object $1 => decodeString($1),
    },
    ipVersion: switch (json['ipVersion']) {
      null => null,
      Object $1 => decodeString($1),
    },
    ipv6EndpointType: switch (json['ipv6EndpointType']) {
      null => null,
      Object $1 => decodeString($1),
    },
    kind: switch (json['kind']) {
      null => null,
      Object $1 => decodeString($1),
    },
    labelFingerprint: switch (json['labelFingerprint']) {
      null => null,
      Object $1 => decodeString($1),
    },
    labels: switch (json['labels']) {
      null => {},
      Map<String, Object?> $1 => {
        for (final e in $1.entries)
          decodeString(e.key): decodeString(e.value),
      },
      _ => throw const FormatException('"labels" is not an object'),
    },
    name: switch (json['name']) {
      null => null,
      Object $1 => decodeString($1),
    },
    network: switch (json['network']) {
      null => null,
      Object $1 => decodeString($1),
    },
    networkTier: switch (json['networkTier']) {
      null => null,
      Object $1 => decodeString($1),
    },
    prefixLength: switch (json['prefixLength']) {
      null => null,
      Object $1 => decodeInt($1),
    },
    purpose: switch (json['purpose']) {
      null => null,
      Object $1 => decodeString($1),
    },
    region: switch (json['region']) {
      null => null,
      Object $1 => decodeString($1),
    },
    selfLink: switch (json['selfLink']) {
      null => null,
      Object $1 => decodeString($1),
    },
    status: switch (json['status']) {
      null => null,
      Object $1 => decodeString($1),
    },
    subnetwork: switch (json['subnetwork']) {
      null => null,
      Object $1 => decodeString($1),
    },
    users: switch (json['users']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"users" is not a list'),
    },
  );
}