Address class

A postal address from a geocoder.

Missing parts are null, never empty strings, and nothing is invented: in many areas a geocoder knows only the city, or returns only a plus code. formatted is always a usable one-line label built from what exists.

Constructors

Address({required String formatted, String? name, String? street, String? houseNumber, String? subLocality, String? locality, String? subAdministrativeArea, String? administrativeArea, String? postalCode, String? country, String? countryCode, Map<String, Object?> raw = const {}})
const

Properties

administrativeArea → String?
Province or state.
final
country → String?
final
countryCode → String?
ISO 3166-1 alpha-2, e.g. PK.
final
formatted → String
One display line. The provider's own line when it gives one, otherwise built from the parts below.
final
hashCode → int
The hash code for this object.
no setteroverride
houseNumber → String?
final
locality → String?
City or town.
final
name → String?
A place or building name, or a plus code ("8FV9+XQ Lahore").
final
postalCode → String?
final
raw → Map<String, Object?>
Provider-specific fields, as the provider returned them.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
street → String?
final
subAdministrativeArea → String?
District.
final
subLocality → String?
Neighbourhood or area within the city.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toMap() → Map<String, Object?>
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
override

Static Methods

fromMap(Map<Object?, Object?> map) → Address?
Reads toMap's output (or a platform map). Returns null when the map has no usable text.
fromParts({String? formatted, String? name, String? street, String? houseNumber, String? subLocality, String? locality, String? subAdministrativeArea, String? administrativeArea, String? postalCode, String? country, String? countryCode, Map<String, Object?> raw = const {}}) → Address?
Builds an address from raw parts: blank strings become null, and formatted is derived from the parts when the provider has no line of its own. Returns null when no part has any text, which a geocoder should report as noResult.