compliance_gdpr library
GDPR building blocks for Flutter apps: consent management with policy versioning, data export, account deletion, and an accessible consent UI.
Every flow can record audit events through a compliance_core
AuditTrail. Event metadata never contains personal data.
Classes
- CallbackDataEraser
- A DataEraser backed by a function.
- CallbackDataSource
- A DataSource backed by a function.
- ConsentChoiceButtons
- "Accept all" and "Reject all" buttons with equal visual weight.
- ConsentManager
- Manages the user's consent for the purposes in a ConsentPolicy.
- ConsentPolicy
- The set of purposes the app asks consent for, with a version.
- ConsentPrompt
- The content of the consent prompt: title, explanation, the list of optional purposes, equal-weight accept and reject buttons, and a button to choose per purpose.
- ConsentPurpose
-
A reason for processing personal data that the user can consent to, for
example
analyticsormarketing. - ConsentRecord
- One consent decision, as stored.
- ConsentState
- An immutable snapshot of the user's consent.
- ConsentStore
- Persists consent records.
- ConsentStrings
- Every user-facing string in the consent UI.
- DataDeletionManager
- Runs "delete my account" (GDPR Art. 17): server-side deletion through a callback, then every registered local DataEraser.
- DataEraser
- Deletes the user's data from one local location, for example a database, preferences, files or caches.
- DataExport
- A finished export. Encode it with toJsonString and give the file to the user, for example through a share sheet.
- DataExporter
- Collects the user's data from every registered DataSource into one JSON document ("export my data", GDPR Art. 15 and 20).
- DataSource
- A place where the app stores the user's data, for example a database table, preferences or files.
- DeletionReport
- Result of a deletion run.
- ExportProgress
- Progress of a running export.
- GdprAuditEvents
- Audit event types recorded by compliance_gdpr.
- InMemoryConsentStore
- A ConsentStore that keeps records in memory. Records are lost when the app restarts, so use it only for tests, examples and prototypes.
- PrivacySettingsScreen
- A screen listing every purpose with a switch.
- RedactingDataSource
-
Wraps a DataSource and redacts its output with a
Redactor. - SourceDeletionResult
- Result for one deletion step.
- SourceExportResult
- Result for one DataSource.
Enums
- ConsentStatus
- Whether the user needs to be asked for consent.
- ErasureStatus
- Outcome of deleting one data location.
- SourceExportStatus
- Outcome of exporting one DataSource.
Functions
-
showConsentBottomSheet(
BuildContext context, {required ConsentManager manager, ConsentStrings strings = const ConsentStrings(), ButtonStyle? buttonStyle}) → Future< ConsentState> - Shows the ConsentPrompt in a modal bottom sheet and returns the state after the user decided. See showConsentDialog.
-
showConsentDialog(
BuildContext context, {required ConsentManager manager, ConsentStrings strings = const ConsentStrings(), ButtonStyle? buttonStyle}) → Future< ConsentState> - Shows the ConsentPrompt in a dialog and returns the state after the user decided.
Typedefs
-
ServerDeletionCallback
= Future<
ErasureStatus> Function() - Calls the app's backend to delete the account and server-side data.
Exceptions / Errors
- ConsentException
- Thrown when a consent operation is invalid, for example withdrawing a strictly necessary purpose or using an unknown purpose id.
- IncompleteRedactionException
-
Thrown by
RedactingDataSourcewhen redaction could not process the whole source (a rule failed, or a size or depth limit was reached), so the export is not silently incomplete.