verify method

Future<void> verify({
  1. required VerifyAuthProvider provider,
})

Used to prove possession of the e-mail address.

Normally, this is done to send an authentication email.

Authentication is performed by passing a class inheriting from VerifyAuthProvider as provider.

メールアドレスの所有を証明するために利用します。

通常はこれを実行することで認証用のメールを送信します。

VerifyAuthProviderを継承したクラスをproviderで渡すことにより、認証を行ないます。

Implementation

Future<void> verify({
  required VerifyAuthProvider provider,
}) async {
  await _initialize();
  final account = active;
  if (account == null) {
    throw Exception(
      "You are not signed in. Please sign in with [signIn] first.",
    );
  }
  final userId = account.get(userIdKey, "");
  if (provider is EmailAndPasswordVerifyAuthProvider) {
    final verified = await onVerify?.call(
      userEmail,
      provider.locale ?? defaultLocale,
    );
    _data._setAccount(userId, {
      ...account,
      verifiedKey: verified,
    });
  } else if (provider is EmailLinkVerifyAuthProvider) {
    final verified = await onVerify?.call(
      userEmail,
      provider.locale ?? defaultLocale,
    );
    _data._setAccount(userId, {
      ...account,
      verifiedKey: verified,
    });
  }
  await onSaved?.call(this);
}