Muhammad Arafat
Muhammad Arafat

Reputation: 83

The plugin `geocoder` uses a deprecated version of the Android embedding

When I run pub get, I face the following error:

The plugin geocoder uses a deprecated version of the Android embedding. To avoid unexpected runtime failures, or future build failures, try to see if this plugin supports the Android V2 embedding. Otherwise, consider removing it since a future release of Flutter will remove these deprecated APIs. If you are plugin author, take a look at the docs for migrating the plugin to the V2 embedding: https://flutter.dev/go/android-plugin-migration.

Upvotes: 3

Views: 20732

Answers (6)

Shadab Hashmi
Shadab Hashmi

Reputation: 387

There is a package called geocoding, to achieve the same functionality. Please refer to it.

Upvotes: 0

Mayank Diwakar
Mayank Diwakar

Reputation: 21

Use This to Fix All Errors
https://pub.dev/packages/geocoder2

import 'package:geocoder2/geocoder2.dart';

Get Address

    FetchGeocoder fetchGeocoder = await Geocoder2.getAddressFromCoordinates(
        latitude: 40.714224,
        longitude: -73.961452,
        googleMapApiKey: "GOOGLE_MAP_API_KEY");
    var first = fetchGeocoder.results.first;
    print(first.formattedAddress);

Get Coordinates

FetchGeocoder fetchGeocoder = await Geocoder2.getCoordinatesFromAddress(
        address: "277 Bedford Ave, Brooklyn, NY 11211, USA",
        googleMapApiKey: "GOOGLE_MAP_API_KEY");
    var first = fetchGeocoder.results.first;
    print("${first.geometry.location.lat} , ${first.geometry.location.lng}");

Upvotes: 2

tonito
tonito

Reputation: 11

Instead of using that plugin you could use the Geocoding plugin to find the address:

import 'package:geocoding/geocoding.dart';

List<Placemark> placemarks = await placemarkFromCoordinates(52.2165157, 6.9437819);

Upvotes: 1

Ajay Krishna P
Ajay Krishna P

Reputation: 141

GeoCoder package is deprecated for the newer flutter version. But there is this alternative you can use. This is compatible with newer flutter version and perfectly working fine. Use this alternative : https://pub.dev/packages/geocode

Upvotes: 3

Fahmida
Fahmida

Reputation: 1220

This is happening because of the latest flutter updated version 2.5. In my case I have downgraded my flutter version by command flutter downgrade and it shows an option of a downgraded flutter version and it resolves my error.

Upvotes: 1

sadji
sadji

Reputation: 112

that simply means that the package you want to use is outdated and the flutter new update removed some functions that this package was using.

quick solution:

  • outdate flutter by running this in the terminal 'flutter pub outdated' which I do not recommend
  • or use an alternative for this package and make sure that this alternative is newly upgraded to be compatible with your flutter version

Upvotes: 0

Related Questions