PostalAddress.fromJson constructor

PostalAddress.fromJson(
  1. Object? j
)

Implementation

factory PostalAddress.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return PostalAddress(
    revision: switch (json['revision']) {
      null => 0,
      Object $1 => decodeInt($1),
    },
    regionCode: switch (json['regionCode']) {
      null => '',
      Object $1 => decodeString($1),
    },
    languageCode: switch (json['languageCode']) {
      null => '',
      Object $1 => decodeString($1),
    },
    postalCode: switch (json['postalCode']) {
      null => '',
      Object $1 => decodeString($1),
    },
    sortingCode: switch (json['sortingCode']) {
      null => '',
      Object $1 => decodeString($1),
    },
    administrativeArea: switch (json['administrativeArea']) {
      null => '',
      Object $1 => decodeString($1),
    },
    locality: switch (json['locality']) {
      null => '',
      Object $1 => decodeString($1),
    },
    sublocality: switch (json['sublocality']) {
      null => '',
      Object $1 => decodeString($1),
    },
    addressLines: switch (json['addressLines']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"addressLines" is not a list'),
    },
    recipients: switch (json['recipients']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"recipients" is not a list'),
    },
    organization: switch (json['organization']) {
      null => '',
      Object $1 => decodeString($1),
    },
  );
}