ConsentController class
Holds and mutates consent state, and answers the delivery questions the client asks: is a category decided, and may a given sink receive it.
Extends ChangeNotifier so a consent banner can rebuild and so the client can replay buffered events the moment consent changes.
- Inheritance
-
- Object
- ChangeNotifier
- ConsentController
Constructors
- ConsentController(ConsentPolicy policy)
-
Creates a controller seeded from
policy's defaults.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- policy → ConsentPolicy
-
The policy this controller enforces.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
decisionFor(
ConsentCategory category) → ConsentStatus -
Whether a message of
categoryshould be delivered right now. -
deny(
ConsentCategory category) → void -
Denies (or revokes) consent for
category. -
denyAll(
) → void - Denies every non-necessary category.
-
dispose(
) → void -
Discards any resources used by the object.
inherited
-
grant(
ConsentCategory category) → void -
Grants consent for
category. -
grantAll(
) → void - Grants every non-necessary category.
-
isDecided(
ConsentCategory category) → bool -
Whether the user has made a decision (granted or denied) for
category. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
reset(
) → void - Clears all decisions back to ConsentStatus.unknown.
-
sinkAllowed(
LiquidSink sink, ConsentCategory category) → bool -
Whether
sinkis eligible to receive events ofcategory, per the category→sink map. Necessary events go to every capable sink. -
statusOf(
ConsentCategory category) → ConsentStatus -
The status of
category. ConsentCategory.necessary is always granted. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited