FlutterMap(
options: MapOptions(
onTap: (p) async {
location = await Geocoder2.getDataFromCoordinates(
latitude: p.latitude, longitude: p.longitude, googleMapApiKey: ''));
print("${location.country}");
setState((){
point=p;
});
},
center: LatLng(40, -1),
zoom: 10.0
),
I am trying to use geocoder2 in my flutter app to work with maps. But I am facing this error. If someone could help, that’d be great.
LatLng point=LatLng(49, -1);
var location=[];
This is my declaration of variables.
>Solution :
onTap callback provide tapPosition and point.
typedef TapCallback = void Function(TapPosition tapPosition, LatLng point);
Include another parameters to solve this case like
onTap: (tapPos, p) async {
More about MapOptions and flutter_map/TapCallback