ConsentPolicy class

Declarative configuration for the consent gate.

This is liquid's flagship feature: it makes GDPR-style opt-in the default so that no analytics leave the device until the user agrees. You describe which sinks belong to which category, whether consent is opt-in or opt-out, and what to do with events emitted before the user decides.

Annotations

Constructors

ConsentPolicy({bool requireOptIn = true, Map<ConsentCategory, List<String>> map = const {}, bool bufferUntilDecision = true, int maxBuffer = 200, Map<ConsentCategory, ConsentStatus> defaults = const {}})
Creates a consent policy.
const

Properties

bufferUntilDecision → bool
When true, events emitted while a category is still ConsentStatus.unknown are buffered and replayed if/when the user grants consent (up to maxBuffer). When false, such events are dropped.
final
defaults → Map<ConsentCategory, ConsentStatus>
Optional initial status per category (e.g. seed from stored preferences).
final
hashCode → int
The hash code for this object.
no setterinherited
map → Map<ConsentCategory, List<String>>
Maps a category to the ids of the sinks that belong to it.
final
maxBuffer → int
The maximum number of buffered messages to retain (oldest dropped first).
final
requireOptIn → bool
When true (default), a category whose status is ConsentStatus.unknown is treated as denied — nothing is sent until the user opts in. When false, unknown is treated as granted (opt-out).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Constants

allowAll → const ConsentPolicy
A permissive policy: everything is treated as granted. Use only where you have a lawful basis that does not require opt-in.