Hello everyone can anyone please help me,
at first i wrote
Future<void> signIn() async {
//we validate fields here
final formState = _formKey.currentState;
if (formState!.validate()) {
// login to firebase
formState.save();
FirebaseUser user = await FirebaseAuth.instance.signInWithEmailAndPassword(email: _email, password: _password);
}
}
then i read that "Firebaseuser" became "User", so after changing it i got errors in FirebaseAuth.instance
A value of type 'UserCredential' can't be assigned to a variable of type 'User'.
Try changing the type of the variable, or casting the right-hand type to 'User'
so then, i changed FireBaseAuth to UserCredential, so i got another error
The getter 'instance' isn't defined for the type 'UserCredential'.
Try importing the library that defines 'instance', correcting the name to the name of an existing getter, or defining a getter or field named 'instance'
What should i do? and how do i re-write my code so it works?