我在我的 Flutter 应用中使用 Firebase 电话身份验证。 电话身份验证在调试模式下工作正常,但在发布模式下它不起作用并且错误也显示为空。 我已经尝试了重复问题中提到的所有解决方案并尝试了
还是不行
Future<void> sendCode() async {
setState(() {
showLoading = true;
});
await _auth.verifyPhoneNumber(
phoneNumber: _countryCode + phoneController.text,
verificationCompleted: (phoneAuthCredential) async {
setState(() {
showLoading = false;
});
},
verificationFailed: (FirebaseAuthException e) async {
setState(() {
showLoading = false;
});
_scaffoldKey.currentState.showSnackBar(
SnackBar(content: Text(e.message)));
Fluttertoast.showToast(
msg: e.message,
toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.CENTER,
timeInSecForIosWeb: 1,
backgroundColor: Colors.red,
textColor: Colors.white,
fontSize: 16.0
);
print(e.message);
},
codeSent: (verificationId, resendingToken) async {
setState(() {
showLoading = false;
Navigator.push(context, MaterialPageRoute(builder: (context)=> VerifyPage(verificationId,_countryCode.toString()+phoneController.text)));
this.verificationId = verificationId;
});
},
codeAutoRetrievalTimeout: (verificationId) async {},
);
}