【发布时间】:2020-12-08 02:40:13
【问题描述】:
我有一个 Flutter 应用程序,管理员可以在其中为其他用户创建帐户(使用 Firebase Authentication)。
我的逻辑类似如下:
UserCredential userCredential =
await authService.instance.createUserWithEmailAndPassword(
email: emailController.text,
password: passwordController.text,
);
main.dart:
MaterialApp(
home: StreamBuilder<User>(
stream: authentcationService.authStateChanges,
builder: (context, snapshot) {
// Build the app
// ...
},
)
)
但是我注意到这会触发上述stream 中的身份验证状态更改:调用createUserWithEmailAndPassword 正在注销当前用户并登录新创建的用户,而不是简单地在 Firebase 身份验证中创建新用户.谁能给点建议?
【问题讨论】:
标签: firebase flutter firebase-authentication