Мой код следующий
Код: Выделить всё
...
...
...
String verificationId;
int resendingToken;
Future _sendConfirmationCode() async {
if (formKey.currentState.validate()) {
formKey.currentState.save();
final PhoneVerificationCompleted verificationCompleted = (FirebaseUser user) {
setState(() {
print('verification has been completed');
});
};
final PhoneVerificationFailed verificationFailed = (AuthException authException) {
setState(() {
print(countrySelected);
print(this.phone + "\n");
print('verification failed error: ' + authException.message);}
);
};
final PhoneCodeSent codeSent = (String verificationId, [int forceResendingToken]) async {
this.verificationId = await verificationId;
this.resendingToken = await forceResendingToken;
print("code sent: "+ verificationId);
};
final PhoneCodeAutoRetrievalTimeout codeAutoRetrievalTimeout =
(String verificationId) {
this.verificationId = verificationId;
print("time out");
};
if (this.phone.isNotEmpty) {
await FirebaseAuth.instance.verifyPhoneNumber(
phoneNumber: "
", //I've tried hardcoding my number too but it didn't work
timeout: const Duration(seconds: 5),
verificationCompleted: verificationCompleted,
verificationFailed: verificationFailed,
codeSent: codeSent,
forceResendingToken: resendingToken,
codeAutoRetrievalTimeout: codeAutoRetrievalTimeout);
}
}
}
Код: Выделить всё
I/flutter (32425): code sent: AM5PThC4JnFK7czWDoAdqSFjBdDk5oq9VwufNvWxgcOg4fEgbHE8CoYGuWMCjzTnfPbOlpcdfefouwL86dsD5fQs73CcR3NgvI2SRqHEHgM0n34yqqJma75ZCvPGMeTmwy6XDCA9-P0p
I/flutter (32425): time out
Подробнее здесь: https://stackoverflow.com/questions/554 ... -with-code