如何正确创建 FlutterFire 期望在网络上进行电话身份验证的容器?


我正在处理FlutterFire 的文档

我正在尝试在网络上实现电话登录。该指南似乎建议 RecaptchaVerifier 是一个可选参数:


FirebaseAuth auth = FirebaseAuth.instance


// Wait for the user to complete the reCAPTCHA & for a SMS code to be sent.

ConfirmationResult confirmationResult = await auth.signInWithPhoneNumber('+44 7123 123 456');

但是,当我尝试使用该方法时,我被迫为 RecaptchaVerifier 提供一个参数:

http://img2.mukewang.com/640180df00012cb308740321.jpg

我已经验证我使用的是正确版本的库 -- firebase_auth: "^0.18.0+1"

那么,为了正确显示 Recaptcha 验证器,我该如何在指定 ID 的 DOM 上创建一个元素?

我在他们的 Github 中找到了以下相关代码,这些代码显示了如何访问该元素,但是我对源代码的具体了解不多。

该怎么办?


哔哔one
浏览 94回答 1
1回答

不负相思意

是的,所以我经历过同样的问题。这里的问题是文档与 PR 不同步:更改文档的 PR 已合并,但您使用的插件 firebase_auth 尚未更改,因此您仍然拥有旧插件和新文档 ..所以解决方案是:你必须像下面这样在你的 pubspec 依赖项中精确提交插件:firebase_auth:     git:      url: https://github.com/FirebaseExtended/flutterfire      path: packages/firebase_auth/firebase_auth      ref: 4a05ceba74c805bc5528137d40c75865cd21d687并且也在 dependencies_override 下面,像这样(如果不存在,添加它,在 dev_dependencies 部分下面):dependency_overrides:  firebase_auth_web:    git:      url: https://github.com/FirebaseExtended/flutterfire      path: packages/firebase_auth/firebase_auth_web      ref: 4a05ceba74c805bc5528137d40c75865cd21d687  firebase_auth_platform_interface:    git:      url: https://github.com/FirebaseExtended/flutterfire      path: packages/firebase_auth/firebase_auth_platform_interface      ref: 4a05ceba74c805bc5528137d40c75865cd21d687顺便说一句,你需要覆盖依赖项的原因是因为 firebase_auth 插件,精确提交仍然使用旧版本的 flutter web 插件
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript