//这是我的main.dart代码
signIn() {
FirebaseAuth.instance
.signInWithPhoneNumber(verificationId: verificationId, smsCode: smsCode)
.then((user) {
Navigator.of(context).pushReplacementNamed('/homepage');
}).catchError((e) {
print(e);
});
}
Run Code Online (Sandbox Code Playgroud)
//这是我的pubspec.yaml代码
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
firebase_auth:
Run Code Online (Sandbox Code Playgroud)
//这是我的logcat
Error: The method 'signInWithPhoneNumber' isn't defined for the class 'FirebaseAuth'.
Try correcting the name to the name of an existing method, or defining a method named 'signInWithPhoneNumber'.
Run Code Online (Sandbox Code Playgroud)
我正在我的 flutter 应用程序中实现电话号码登录。我安装了所有依赖项,并在我的项目中粘贴了 google_services.json 文件。
小智 6
遇到了同样的问题。我相信它已被替换:
final AuthCredential credential = PhoneAuthProvider.getCredential(
verificationId: _verificationId,
smsCode: _smsController.text,
);
final FirebaseUser user = await _auth.signInWithCredential(credential);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4513 次 |
| 最近记录: |