Skip to content

I have issue in getlocationData() method using Navigator.push of LocationScreen(); #36

Open
@Midhunap

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions