Address class
A postal address.
Postal address structure varies widely by country. See: https://en.wikipedia.org/wiki/Address#Format_by_country_and_area
Data models such as those from Android and iOS are typically US-centric and include street, city, state, zip code. They also always include a free-form formatted address, which we recommend to use instead. That said, other fields are included for compatibility.
+--------------+---------+-----+ | field | android | iOS | +--------------+---------+-----+ | street | ✅ | ✅ | | pobox | ✅ | ❌ | | neighborhood | ✅ | ❌ | | city | ✅ | ✅ | | state | ✅ | ✅ | | postalCode | ✅ | ✅ | | country | ✅ | ✅ | | isoCountry | ❌ | ✅ | | subAdminArea | ❌ | ✅ | | subLocality | ❌ | ✅ | +--------------+---------+-----+
- Annotations
- @JsonSerializable(disallowUnrecognizedKeys: true)
Constructors
- Address(String address, {AddressLabel label: AddressLabel.home, String customLabel: "", String street: "", String pobox: "", String neighborhood: "", String city: "", String state: "", String postalCode: "", String country: "", String isoCountry: "", String subAdminArea: "", String subLocality: ""})
-
Address.fromJson(Map<
String, dynamic> json) -
factory
Properties
- address ↔ String
-
Free-form formatted address. [...]
@JsonKey(required: true), read / write
- city ↔ String
-
City/town.
@JsonKey(defaultValue: ""), read / write
- country ↔ String
-
Country as a free-form text (e.g. "France").
@JsonKey(defaultValue: ""), read / write
- customLabel ↔ String
-
If label is AddressLabel.custom, free-form user-chosen label.
@JsonKey(defaultValue: ""), read / write
- hashCode → int
-
The hash code for this object. [...]
read-only, inherited
- isoCountry ↔ String
-
Country in the ISO 3166-1 alpha-2 standard (e.g. "fr"). iOS only.
@JsonKey(defaultValue: ""), read / write
- label ↔ AddressLabel
-
The label or type of address it is. If
custom
, the free-form label can be found in customLabel. [...]@JsonKey(defaultValue: AddressLabel.home), read / write - neighborhood ↔ String
-
According to Android's doc, this can help disambiguate a street address in
cases the same city has several streets with the same name. Android only.
@JsonKey(defaultValue: ""), read / write
- pobox ↔ String
-
P.O. box. This is (according to Android's doc) usually but not always
mutually exclusive with street. Android only.
@JsonKey(defaultValue: ""), read / write
- postalCode ↔ String
-
Zip code (US), postcode (UK), etc.
@JsonKey(defaultValue: ""), read / write
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
- state ↔ String
-
State (in the US). [...]
@JsonKey(defaultValue: ""), read / write
- street ↔ String
-
Street name. At least on Android this also includes house number and
room/apartment/flat/floor number.
@JsonKey(defaultValue: ""), read / write
- subAdminArea ↔ String
-
Subadministrative area, such as region or county. iOS only. On Android
those are folded into state (which Android calls "region").
@JsonKey(defaultValue: ""), read / write
- subLocality ↔ String
-
Any additional information associated with the location. iOS only.
@JsonKey(defaultValue: ""), read / write
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
toJson(
) → Map< String, dynamic> -
toString(
) → String -
Returns a string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator. [...]
inherited