【发布时间】:2021-10-02 20:41:40
【问题描述】:
我在 auth.authStateChanges() 上得到红线,
错误提示:无法从函数“user”返回类型为“Stream
class Auth {
final FirebaseAuth auth;
Auth({required this.auth});
Stream<User>? get user => auth.authStateChanges(); <-- here
现在更新我得到这个错误:
Future<String?> createAccount({required String email, required String password}) async {
try {
await auth.createUserWithEmailAndPassword( <-- here **auth**
email: email.trim(),
password: password.trim(),
);
return "Success";
} on FirebaseAuthException catch (e) {
return e.message;
} catch (e) {
rethrow;
}
}
【问题讨论】:
-
Stream<User?> get user更改了 Stream上的可为空值? -
@RaineDaleHolgado 现在我在 auth 下遇到错误:未定义的名称“auth”。查看更新