validateVerificationCode method

Future<Map<String, dynamic>?> validateVerificationCode({
  1. required String provider,
  2. required String method,
  3. required String smsCode,
  4. required String verificationId,
})

Verifies the phone code with the provided smsCode and verificationId.

Implementation

Future<Map<String, dynamic>?> validateVerificationCode({
  required String provider,
  required String method,
  required String smsCode,
  required String verificationId,
}) async {
  try {
    if (provider == 'firebase') {
      if (method != 'phone') {
        throw ArgumentError('Unsupported method: $method');
      }
      return await _validateFirebaseVerificationCode(
        smsCode: smsCode,
        verificationId: verificationId,
      );
    } else {
      throw ArgumentError('Unsupported provider: $provider');
    }
  } catch (e) {
    rethrow;
  }
}