Open payner35 opened 2 years ago
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'));
@payner35 You can use my fork which makes all fields nullable:
geocoder_buddy: git: url: https://github.com/jtmuller5/geocoder_buddy
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'));