delete method

Deletes already registered users.

Users created by AuthProvider who are registered together with signIn even if register is not executed are also eligible.

すでに登録されているユーザーを削除します。

registerが実行されていない場合でもsignInで合わせて登録が行われるAuthProviderで作成されたユーザーも対象となります。

Implementation

Future<Authentication> delete() async {
  if (!isSignedIn) {
    throw Exception("Not yet signed in.");
  }
  for (final action in _effectiveActions) {
    await action.onSignOut();
  }
  final userId = this.userId;
  await adapter.delete(onUserStateChanged: notifyListeners);
  _sendLog(AuthLoggerEvent.delete, parameters: {
    AuthDatabase.userIdKey: userId,
  });
  if (!isSignedIn) {
    for (final action in _effectiveActions) {
      await action.onSignedOut();
    }
  }
  return this;
}