Pul*_*epa 1 android-studio firebase-authentication flutter
我正在为 android 设备从 flutter 设计一个聊天应用程序,但是当我添加一个用于 firebase 身份验证的插件时,它给出了以下异常。我正在接受你的回答。先感谢您!
Flutter: MissingPluginException(No implementation found for method createUserWithEmailAndPassword on channel plugins.flutter.io/firebase_auth)
这是注册屏幕中的代码
class _RegistrationScreenState extends State<RegistrationScreen> {
final _auth = FirebaseAuth.instance;
String email;
String password;
.
.
.
onPressed: () async{
try {
final newUser = await _auth.createUserWithEmailAndPassword(
email: email, password: password);
if(newUser!=null){
Navigator.pushNamed(context, ChatScreen.id);
}
}catch(e){
print(e);
}
},
Run Code Online (Sandbox Code Playgroud)
这是聊天屏幕中的代码
class _ChatScreenState extends State<ChatScreen> {
final _auth = FirebaseAuth.instance;
FirebaseUser loggedInUser;
@override
void initState(){
super.initState();
getCurrentUser();
}
void getCurrentUser() async{
try {
final user = await _auth.currentUser();
if (user != null) {
loggedInUser = user;
print(loggedInUser.email);
}
}catch(e){
print(e);
}
}
.
.
.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3999 次 |
| 最近记录: |