当前位置: 首页 > 知识库问答 >
问题:

如何使用sendEmailVeration()方法

袁开宇
2023-03-14

尝试在 Flutter 中为 Firebase 电子邮件/密码身份验证方法设置firebase_auth包,但需要电子邮件验证方面的帮助。

我是通过sendEmailVerification()来的;方法由firebase_auth软件包提供,但需要一些有关设置的建议。有没有人有一个工作代码示例可以遵循?

// From firebase_auth package docs > https://pub.dartlang.org/documentation/firebase_auth/latest/firebase_auth/FirebaseUser/sendEmailVerification.html

Future<void> sendEmailVerification() async {
  // TODO(amirh): remove this on when the invokeMethod update makes it to stable Flutter.
  // https://github.com/flutter/flutter/issues/26431
  // ignore: strong_mode_implicit_dynamic_method
  await FirebaseAuth.channel.invokeMethod(
      'sendEmailVerification', <String, String>{'app': _app.name});
}

如果可能的话,任何帮助、建议、指导都将不胜感激。

共有1个答案

杜俊楚
2023-03-14

如果您创建 FirebaseUser,则此方法将起作用。它可以这样使用:

await _auth.createUserWithEmailAndPassword (
  email: //wherever you set their email,
  password: //wherever you set their password,
).then((FirebaseUser user) {
  //If a user is successfully created with an appropriate email
if (user != null){
  user.sendEmailVerification();
}
})
.catchError();
 类似资料:
  • 问题内容: 下面的代码将三个数字放在一个队列中。然后,它尝试从队列中取回数字。但是它从来没有。如何从队列中获取数据? 问题答案: 在阅读@Martijn Pieters的文章后,我最初删除了此答案,因为他更详细地描述了“为什么这不起作用”以及更早的版本。然后我意识到,OP的示例中的用例并不完全符合 “如何使用multiprocessing.Queue.get方法”。 这不是因为没有用于演示的子进程

  • 嘿,我是python新手,正在使用tkinter作为我的gui。我在使用“after”方法时遇到问题。目标是每5秒出现一个随机字母。 这是我的代码: 谁能帮帮我吗?问题肯定出在框架上。(500)之后:我不确定使用“frame”是否正确,我不知道500后面的参数是什么。 谢啦

  • 问题内容: 正在将tkinter用于gui,我在使用之后方法时遇到麻烦。目的是使每5秒出现一个随机字母。 这是我的代码: 有人可以帮我吗—问题肯定是frame.after(500):我不确定使用“ frame”是否正确,我也不知道500后面是哪个参数。 问题答案: 您需要给定一个在时间延迟后要调用的函数,作为第二个参数after: 注册在给定时间后调用的警报回调。 因此,您真正想要做的是: 您还需

  • 本文向大家介绍如何使用Java子串方法?,包括了如何使用Java子串方法?的使用技巧和注意事项,需要的朋友参考一下 String类的方法具有两个变体,并返回一个新字符串,该字符串是当前字符串的子字符串。子字符串以指定索引处的字符开头,并延伸到该字符串的末尾,或者直到给定第二个参数的endIndex – 1。 示例 输出结果

  • 问题内容: 使用Play Framework,我通过GSON序列化了模型。我指定哪些字段是公开的,哪些不是。 这很好用,但我也想使用@expose方法。当然,这太简单了。 我该怎么做 ? 谢谢你的帮助 ! 问题答案: 我遇到的最好的解决方案是制作一个专用的序列化器: 并在我看来像这样使用它: 但是为某个方法工作会很棒:它将避免使序列化器仅用于显示方法!