Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Skipped x frames! The application may be doing too much work on its main thread. What does this error signify and how to solve this?

Tags:

I'm trying to do authentication with firbase in my Flutter app. Once the user is signed in and goes to the Authenticted screen, this error shows up. I'm using google_signin plugin with simple logics.

    bool isAuth = false;

  //check if the user is signed in
  @override
  void initState() {
    super.initState();
    googleSignIn.onCurrentUserChanged.listen((account) {
      handleSignIn(account);
    }, onError: (err) {
      print("Error signing in: $err");
    });
    //maintain the signin
    googleSignIn.signInSilently(suppressErrors: false).then((account) {
      handleSignIn(account);
    }).catchError((err) {
      print("Error signing in: $err");
    });
  }

  handleSignIn(GoogleSignInAccount account) {
    if (account != null) {
      print('User signed in!: $account');
      setState(() {
        isAuth = true;
      });
    } else {
      setState(() {
        isAuth = false;
      });
    }
  }

  //sign in using google
  login() {
    googleSignIn.signIn();
  }

  logout() {
    googleSignIn.signOut();
  }

  Widget buildAuthScreen() {
    return Center(
      child: RaisedButton(
        child: Text("LogOut"),
        onPressed: logout(),
      ),
    );
  }

then the unauth screen has basic login layout for signining in...