As far as I can see, there are numerous deprecated methods in flutter firebase authentication.
here is my code;
FlatButton(
child: Text("Confirm"),
textColor: Colors.white,
color: Colors.blue,
onPressed: () async {
FirebaseAuth _auth = FirebaseAuth.instance; // I didn't use it here. I did for you to see
final code = _codeController.text.trim();
final AuthCredential credential = PhoneAuthProvider.getCredential(
verificationId: verificationId, smsCode: code);
UserCredential result =
await _auth.signInWithCredential(credential);
User user = result.user;
if (user != null) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
HomeScreen(user: user)));
} else {
print("Error");
}
},
)
I try to do phone auth but getCredential has error. I looked at firebase documentation. it says that PhoneAuthProvider deprecated and I should use PhoneAuthCredential with getCredential. I used it but it didn't work. I saw that there are various question about this error on stackoverflow but I can't find workaround yet