deleteAccountData function

Future<void> deleteAccountData(
  1. Ref ref,
  2. String userId
)

Deletes everything this device holds for userId, its local games included.

Account deletion only. Signing out keeps an account's replica, so signing back in is instant and works offline (decision 0013); deleting the account is the end of it, and the server's copies of its synchronized games are anonymized by the same deletion that brought us here.

Implementation

Future<void> deleteAccountData(Ref ref, String userId) async {
  final database = await ref.read(replicaDatabaseProvider.future);
  await AccountReplica(database, userId).deleteAll();
}