setConsent method
Set Consent
Implementation
void setConsent(bool newValue) {
// flush the hits from the pool
if (newValue == false) {
this.trackingManager?.flushAllTracking(this.visitorId);
// Erase the related data in cache
this.config.visitorCacheImp?.flushVisitor(this.visitorId);
}
// Update the state for visitor
_hasConsented = newValue;
// Delegate the action to strategy
_visitorDelegate.setConsent(_hasConsented);
// Update the value for the data usage tracking
dataUsageTracking.updateConsent(newValue);
}