title: Flutter: OTP is being sent again and again although user is registered in Firebase Auth
body: <p>I'm using <code>flutter_auth</code> package to apply <strong>Phone Auth</strong>. Normally it sends the <strong>OTP</strong> when a new phone number is registered. But it is sending <strong>OTP again and again</strong> although the user's phone number is there in <code>Firebase authentication list</code></p>
  
  <p>One more thing is it is working fine on few devices, the normal way. Is there any thing wrong with syncing issue? means does it take some time to get sync with firestore or not?</p>
  
  <p>Here's my code of <code>phone auth</code> What am I doing wrong?</p>
  
  <pre><code>phoneAuth(String phone) async {
        FirebaseAuth _auth = FirebaseAuth.instance;
  
        _auth.verifyPhoneNumber(
            phoneNumber: phone,
            timeout: Duration(seconds: 60),
            verificationCompleted: (AuthCredential credential) async {
              Navigator.pop(context);
              AuthResult authResult =
                  await _auth.signInWithCredential(credential);
  
              FirebaseUser user = authResult.user;
  
              if (user != null) {
                Navigator.push(
                    context,
                    new MaterialPageRoute(
                        builder: (context) =&gt; AddContacts(
                              user: user,
                            )));
              } else {
                print("ERROR");
              }
            },
            verificationFailed: (AuthException exception) {
              Toast.show('Try Again Later', context,
                  backgroundColor: Colors.red,
                  duration: 3,
                  gravity: Toast.BOTTOM);
            },
            codeSent: (String verification, [int forceResendingToken]) {
              showDialog(
                  context: context,
                  barrierDismissible: false,
                  builder: (context) {
                    return AlertDialog(
                      shape: RoundedRectangleBorder(
                          borderRadius: BorderRadius.circular(12)),
                      title: Text('Enter 6-Digit Code'),
                      content: Column(
                        mainAxisSize: MainAxisSize.min,
                        children: &lt;Widget&gt;[
                          TextField(
                            controller: _controllerCode,
                            keyboardType: TextInputType.number,
                            maxLength: 6,
                            decoration: InputDecoration(
                              errorText: validateCode(_controllerCode.text),
                              hintText: 'Enter Code',
                              enabledBorder: OutlineInputBorder(
                                  borderRadius: BorderRadius.circular(12.0)),
                              focusedBorder: OutlineInputBorder(
                                  borderRadius: BorderRadius.circular(12.0)),
                              errorBorder: OutlineInputBorder(
                                  borderRadius: BorderRadius.circular(12.0),
                                  borderSide: BorderSide(color: Colors.red)),
                              focusedErrorBorder: OutlineInputBorder(
                                  borderRadius: BorderRadius.circular(12.0),
                                  borderSide: BorderSide(color: Colors.red)),
                            ),
                          )
                        ],
                      ),
                      actions: &lt;Widget&gt;[
                        Text(
                          "Wait for Automatic Detection!",
                          style: TextStyle(fontSize: 10, color: Colors.red),
                        ),
                        FlatButton(
                          padding: EdgeInsets.symmetric(horizontal: width * .05),
                          shape: RoundedRectangleBorder(
                              borderRadius: BorderRadius.circular(12)),
                          child: Text("Confirm"),
                          textColor: Colors.white,
                          color: Colors.lightBlue,
                          onPressed: () async {
                            setState(() {
                              _controllerCode.text.isEmpty
                                  ? _validateCode = true
                                  : _validateCode = false;
                            });
                            final code = _controllerCode.text.trim();
                            AuthCredential credential =
                                PhoneAuthProvider.getCredential(
                                    verificationId: verification, smsCode: code);
                            AuthResult result =
                                await _auth.signInWithCredential(credential);
                            FirebaseUser user = result.user;
                            if (user != null) {
                              Navigator.push(
                                  context,
                                  new MaterialPageRoute(
                                      builder: (context) =&gt; AddContacts(
                                            user: user,
                                          )));
                            } else {
                              Toast.show("ERROR: Code mismatch!", context,
                                  backgroundColor: Colors.red,
                                  gravity: Toast.TOP);
                            }
                          },
                        )
                      ],
                    );
                  });
            },
            codeAutoRetrievalTimeout: null);
      }
  </code></pre>