Search code examples
google-mapsdartfluttergoogle-geocoderflutter-dependencies

pincode or zipcode not getting from geocode


I am developing a flutter app. I want to print the pincode zip code of place. I am using geocoder library. The version is geocoder 0.1.1 . I am trying the example shown library page https://pub.dartlang.org/packages/geocoder#-example-tab- The problem is pincode or zip code is not getting. It not coming. But the pincode is showing in address line.

    try{
        var geocoding = AppState.of(context).mode;
        var longitude = double.parse(_controllerLongitude.text);
        var latitude = double.parse(_controllerLatitude.text);
        var results = await geocoding.findAddressesFromCoordinates(new Coordinates(latitude, longitude));
        this.setState(() {
            this.results = results;
        });
    }
    catch(e) {
        print("Error occured: $e");
    }
    finally {
        this.setState(() {
            this.isLoading = false;
        });
    }
}

The results[0].addressLinewill show address line with pincode. But results[0].postalCode showing null. How to solve the issue? Please help me? I am new to flutter.

Screenshot


Solution

  • The problem is solved after changing the version. I changed the version geocoder to 0.1.2.

    https://github.com/aloisdeniel/flutter_geocoder/issues/2#issuecomment-444282646