How do I add in-app account deletion to a Flutter app?

Add a "Delete my account" button in Settings that calls a server-side function which (1) deletes the auth user, (2) deletes user-owned data across tables, and (3) cancels any active RevenueCat subscription. All in one atomic flow.

Why it matters

Apple App Review Guideline 5.1.1(v) requires an in-app path — a "contact us" email is a rejection. Google Play's Data Safety section also requires disclosing your deletion path.

How to do it

  1. Add the UI in Settings

    A red "Delete my account" button, a confirmation dialog with a warning that deletion is permanent, and (optionally) require the user to re-authenticate.

  2. Server function: delete auth user

    Supabase: supabase.auth.admin.deleteUser(userId) from an edge function with the service role key. Firebase: admin.auth().deleteUser(uid) from a Cloud Function.

  3. Server function: delete user data

    Cascade-delete every row where user_id = deleted user. If you rely on RLS, this must run as a service role.

  4. Cancel RevenueCat subscription

    Call RevenueCat REST API DELETE /v1/subscribers/{app_user_id}. Note: the store subscription itself is not cancelled — the user must cancel through App Store/Play. But the RevenueCat record is cleaned.

  5. Sign out on client

    After the server function returns success, call auth.signOut() and route back to the login screen.

Frequently asked

Do I have to delete data immediately?
Immediately in the auth database. Some jurisdictions (GDPR) allow a short retention for legal reasons, but the user must not be able to log in again.
What about backups?
Backups are exempt if they are inaccessible without a restore. Standard practice.

Sources