I'm using Firebase to sign in with phone number it does send OTP message but when I'm trying to sign with credentials using the OTP I got and the verification ID (they're not null they do have values) it returns null here (result is null) not throwing any errors here's my code
static Future<UserCredential?> verifyOTP(
String verificationId, String otp) async {
UserCredential? result;
try {
print(otp);
print(verificationId);
PhoneAuthCredential credential = PhoneAuthProvider.credential(
verificationId: verificationId,
smsCode: otp,
);
result = await _firebaseAuth?.signInWithCredential(credential);
User? user = _firebaseAuth?.currentUser;
print('user $user');
print('results $result');
} on FirebaseAuthException catch (error) {
print(error);
}
return result;
}