updatePhoneNumber method

Future<void> updatePhoneNumber(
  1. String code
)

Update phone number

Throws a LogInWithGoogleFailure if an exception occurs.

Implementation

Future<void> updatePhoneNumber(String code) async {
  try {
    await _firebaseAuth.currentUser?.updatePhoneNumber(
      PhoneAuthProvider.credential(
        verificationId: verificationId,
        smsCode: code,
      ),
    );
  } on FirebaseAuthException catch (e) {
    throw LogInWithGoogleFailure.fromCode(e.code);
  } catch (_) {
    throw const LogInWithGoogleFailure();
  }
}