I have issue in getlocationData() method using Navigator.push of LocationScreen(); #36
Open
Description
while using Navigator.push of loadingScreen
Error :'Do not use BuildContext of async gaps'
void getLocationData() async {
Location location = Location();
await location.getCurrentLocation();
longitude = location.longitude;
latitude = location.latitude;
NetworkHelper networkHelper = NetworkHelper(
'https://api.openweathermap.org/data/2.5/weather?lat=$latitude&lon=$longitude&appid=$apiKey');
var weatherData = await networkHelper.getData();
Navigator.push(context, MaterialPageRoute(builder: (context){
return LocationScreen();
}));
}
Metadata
Assignees
Labels
No labels