Closed malikdanishalii closed 3 years ago
The error resolved by running the application on real / physical devices because emulator or simulator has the problem of getting real time location as per my knowledge and understanding after working for three days on this issue.
I am getting the API response when i put hardcoded values in Lon and lat but whenever i replace it with the variables that i declared it gives me the error 400. I have tried very hard to solve this but in vain kindly some one help me regarding this.
The code is here:
` void getData() async { var response = await http.get(Uri.parse( 'https://api.openweathermap.org/data/2.5/weather?lat=$latitude&lon=$longitude&appid=2a2ebb0a274ae93918a45df74879b8d6', )); if (response.statusCode == 200) { String data = response.body; var decodedData = jsonDecode(data);
}`