Open chrissy-dev opened 1 year ago
Try to set the type as ConsentInfo
instead of BasicConsentInfo
to get access to the relevant variables.
Example:
final info = await IabtcfConsentInfo.instance.currentConsentInfo() as ConsentInfo;
bool hasAdsGranted = info.purposeConsents.contains(DataUsagePurpose.selectBasicAds) ?? false;
print(hasAdsGranted); // should display true or false
It got me some time to figure out, so I posted it for other people who might land here too.
I can't seem to access
publisherConsents
in the return. I can print it but I can't access it? Any ideas? I'm using the demo code.I'd like to create a wrapper that takes a widget, checks for consent and decides whether the it can load.
I'd like to have a conditional check in the
build
but I can't access the data. I can see the data being printed but I'm unsure how to access it.