App crashes when location permission is denied on android emulator
KiranThomasCherian opened this issue · comments
Kiran Thomas Cherian commented
Linda TJ commented
You should try adding a future.delayed function which takes to the location screen after a delay and pass null as values.
This might help.
void getLocationData() async {
var weatherData;
Future.delayed(Duration(seconds: 15), () {
if (weatherData == null) {
Navigator.push(
context,
MaterialPageRoute(
builder: (ctx) => LocationScreen(weatherData: null)));
}
});
weatherData = await WeatherModel().getLocationWeather();
Navigator.push(
context,
MaterialPageRoute(
builder: (ctx) => LocationScreen(weatherData: weatherData)));
}