resendSignUpCode method

Future<void> resendSignUpCode(
  1. String username
)

Resend sign-up code to the given username for verification

Implementation

Future<void> resendSignUpCode(
  String username,
) async {
  emit(state.startLoading(resendSignUpCodeLoading));

  try {
    final verification = await provider.resendSignUpCode(username);
    emit(state.copyWith(
      awaitingVerification: verification,
    ));
  } on ResendSignUpCodeLimitException catch (error, stackTrace) {
    emit(state.addMessage(
      Message.error(_localizations.resendSignUpCodeLimit),
      error,
      stackTrace,
    ));
  } on ResendSignUpCodeException catch (error, stackTrace) {
    emit(state.addMessage(
      Message.error(
        _localizations.resendSignUpCodeError(error.message),
      ),
      error,
      stackTrace,
    ));
  } finally {
    emit(state.endLoading(resendSignUpCodeLoading));
  }
}