sendVerificationCode method

Future<void> sendVerificationCode(
  1. String attribute
)

Sends a verification code to verify the given attribute

Implementation

Future<void> sendVerificationCode(
  String attribute,
) async {
  emit(state.startLoading(sendVerificationCodeLoading));

  try {
    final verification = await provider.sendVerificationCodeForAttribute(
      attribute,
    );
    emit(state.copyWith(
      awaitingVerification: verification,
    ));
  } on VerifyUserAttributeException catch (error, stackTrace) {
    emit(state.addMessage(
      Message.error(
        _localizations.sendVerificationCodeError(error.message),
      ),
      error,
      stackTrace,
    ));
  } finally {
    emit(state.endLoading(sendVerificationCodeLoading));
  }
}