GeoLocationResponse class
This class represents the response object from the Geo Location API.
This class contains an estimate of the location. Note that the location information included in the response returned from this API is approximate and not accurate.
Example:
void main() async {
// It's very easy to call api with get function.
// It has no class so it's better to set alias 'location' like below.
final response = await location.get();
if (response.status.isNotOk) {
// Do something when it's client or server error.
if (response.status.isClientError) {
return;
} else if (response.status.isServerError) {
return;
} else {
return;
}
}
print(response.country);
print(response.latitude);
print(response.longitude);
}
Constructors
-
GeoLocationResponse.from({required int statusCode, required String reasonPhrase, required Map<
String, String> headers, required String country, required String state, required String stateName, required String zipcode, required String timezone, required String latitude, required String longitude, required String city, required String continent}) - Returns the new instance of GeoLocationResponse based on arguments.
Properties
- city → String
-
The city
final
- continent → String
-
The continent
final
- country → String
-
The country
final
- hashCode → int
-
The hash code for this object.
no setteroverride
-
headers
→ Map<
String, String> -
The http headers
finalinherited
- latitude → String
-
The latitude
final
- longitude → String
-
The longitude
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- state → String
-
The state
final
- stateName → String
-
The state name
final
- status → Status
-
The http status
finalinherited
- timezone → String
-
The time zone
final
- zipcode → String
-
The zip code
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override