confirmEmailChange method

Future<void> confirmEmailChange(
  1. String token,
  2. bool newsletterAgreement, {
  3. required void onSuccess(),
  4. required void onError(
    1. SyneriseError error
    ),
})

The function confirmEmailChange in Dart confirms the change of email with a token and updates the newsletter agreement.

Args: token (String): A string representing the token used to confirm the email change. This token is generated and sent to the user's email address when they request to change their email. newsletterAgreement (bool): A boolean value indicating whether the user has agreed to receive newsletters or not.

Implementation

Future<void> confirmEmailChange(String token, bool newsletterAgreement,
    {required void Function() onSuccess,
    required void Function(SyneriseError error) onError}) async {
  SyneriseResult<void> result =
      await _methods.confirmEmailChange(token, newsletterAgreement);

  result.onSuccess((result) {
    onSuccess();
  }).onError((error) {
    onError(error);
  });
}