Skip to content

GBData errors with some address fields #1

@payner35

Description

@payner35

I live in Dubai.. so the results are default not in english. Plus some of the address fields come back as Null.. causing a String error. This will fix that in GBData.dart

factory Address.fromJson(Map<String, dynamic> json) => Address(
road: json['road'] ?? "",
village: json["village"] ?? "",
county: json["county"] ?? "",
stateDistrict: json["state_district"] ?? "",
state: json["state"] ?? "",
iso31662Lvl4: json["ISO3166-2-lvl4"] ?? "",
postcode: json["postcode"] ?? "",
country: json["country"] ?? "",
countryCode: json["country_code"] ?? "",
);

To fix the lang... you can add a &accept-language=en

var request = http.Request(
'GET',
Uri.parse(
'$PATH/reverse?lat=${pos.latitude}&lon=${pos.longitude}&accept-language=en&format=jsonv2'));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions