double lat;
double lon;
var position = await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
lat = position.longitude;
lon = position.latitude;
Im trying to get the device location and i have the same project building the IOS and Android App but for IOS im getting the GPS location as 37.785834,-122.406417 and android 35.6496833,139.7517317 which is the correct.
if i change the lat = -(position.longitude);
then it makes the android app gives the negative latitude. any way to avoid this without having separate projects for each apps
Make sure you are using real device on the iOS part.
The Geolocation shown on Simulator is a preset value which can be modified via the iOS Simulator menu, go to Debug -> Location -> Custom Location. There you can set the latitude and longitude and test the app accordingly.