Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App crashes when location permission is denied on android emulator #7

Open
KiranThomasCherian opened this issue May 24, 2020 · 1 comment

Comments

@KiranThomasCherian
Copy link

Annotation 2020-05-25 012304

@sam-tj
Copy link

sam-tj commented May 31, 2020

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)));
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants