1
votes

I am building a flutter web app which uses firebase to signup with mobile number. When I try to sign in the recaptcha sometimes appears and once I click verify the UI freezes

void onVerifyMobileNumber(String mobileNumber){
    String number = mobileNumber.substring(1);

    Future<ConfirmationResult> result = _firebaseAuth.signInWithPhoneNumber("+44$number");
    result.then((result){
      _verificationId = result.verificationId;
      _streamController.add(true);
      return;
    }, onError: (){
      _streamController.add(UnsuccessfulEvent());
      return;
    });
}

Looking at the inspection in the browser I get various errors eg:

Uncaught (in promise) Timeout (f)

enter image description here

1

1 Answers

0
votes

You are not awaiting for the future to return. Try this

await result.then((response){ 
..... 
}