I have a function that shared data to whatsapp number, but when sending a google location it`s not working.
when printing the URL that I get at this function:
https://www.google.com/maps/search/?api=1&query=9.5191017,8.1450133
but I see that in WhatsApp look like:
https://www.google.com/maps/search/?api=1
my code :
_launchURL() async {
var phonenumber = numberphone.substring(1,10);
var url = 'https://wa.me/+972$phonenumber?text=$textToSend';
print(url);
if (await canLaunch(url)) {
await launch(url);
} else {
throw 'Could not launch $url';
}
}
my code that called the _launchURL()
onPressed: () async{
Position position = await getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
textToSend='https://www.google.com/maps/search/?api=1&query=${position.latitude},${position.longitude}'.toString() ;
_launchURL();
}
any one can help me how to share location in whatsapp app using flutter ? Thank you