i have a working app with an "old" firebase auth widget. Now the auth was updated and nothing is working anymore.
can you help me fixing it????
This is the whole widget:
import 'package:firebase_auth/firebase_auth.dart';
class AuthService {
final FirebaseAuth _firebaseAuth = FirebaseAuth.instance;
// ignore: deprecated_member_use
Stream<String> get onAuthStateChanged => _firebaseAuth.onAuthStateChanged.map(
(User user) => user?.uid,
);
//Email & Password Sign up
Future<String> createUserWithEmailAndPassword(
String email, String password, String name) async {
final currentUser = await _firebaseAuth.createUserWithEmailAndPassword(
email: email,
password: password,
);
//Update the Username
var userUpdateInfo = UserUpdateInfo();
userUpdateInfo.displayName = name;
await currentUser.updateProfile(userUpdateInfo);
await currentUser.reload();
return currentUser.uid;
}
//Email Password Sign In
Future<String> signInWithEmailAndPassword(
String email, String password) async {
return (await _firebaseAuth.signInWithEmailAndPassword(
email: email, password: password))
.user
.uid;
}
//Sign Out
signOut() {
return _firebaseAuth.signOut();
}
}
And this part from widget is not working anymore:
//Update the Username
var userUpdateInfo = UserUpdateInfo();
userUpdateInfo.displayName = name;
await currentUser.updateProfile(userUpdateInfo);
await currentUser.reload();
return currentUser.uid;
Here are the Errors:
error: The method 'UserUpdateInfo' isn't defined for the type 'AuthService'. error: The method 'updateProfile' isn't defined for the type 'UserCredential'. error: The method 'reload' isn't defined for the type 'UserCredential'. error: The getter 'uid' isn't defined for the type 'UserCredential'.