基本上我有一个按钮(GestureDetector)可以在同一个文件中调用 Future 函数。问题是该功能中的小部件没有按应有的方式出现,但后台进程正在成功运行。
触发:
showDialog(
context: context,
builder: (context) {
AlertDialog(
/// Below the button to call function *resetPassword*
GestureDetector(
child: Text("Yes"),
onTap: () async {
Navigator.of(context).pop();
resetPassword('manan@gmail.com')}))})
小部件功能:
Future<Widget> resetPassword(email) async {
try{
await FirebaseAuth.instance.sendPasswordResetEmail(email: email)
return AlertDialog(
///the content of dialog)
}on FirebaseAuthException catch (e) {
return AlertDialog(
///the content of dialog)
}}
令人惊讶的是,重置密码的电子邮件已成功发送。
免责声明:我是 Flutter 新手,希望 sifus 能体谅一下。