sendVerificationEmail method

Future<EmailVerificationResponse> sendVerificationEmail(
  1. String userId
)

Sends an email for User ID verification.

userId should be a valid email address, as it's used for identity verification.

Throws EmailVerificationException if the email sending fails or if another issue occurs during the email verification process.

Implementation

Future<EmailVerificationResponse> sendVerificationEmail(String userId) async {
  try {
    final response = await _sdk.sendVerificationEmail(userId);
    final emailVerificationResponse = response._toEmailVerificationResponse();
    return emailVerificationResponse;
  } on PlatformException catch(e) {
    final exceptionCode = e._getExceptionCode();
    if(exceptionCode is MEmailVerificationExceptionCode) {
      throw EmailVerificationException._create(
        exceptionCode.toEmailVerificationExceptionCode(),
        e.details["backoff"],
        e.details["error"]
      );
    } else {
      rethrow;
    }
  }
}