requestConsentInfoUpdate method
- AdropConsentListener listener
Request consent info update and show consent form if required
listener Callback that receives the consent result
Implementation
Future<void> requestConsentInfoUpdate(AdropConsentListener listener) async {
try {
final result = await _methodChannel.invokeMethod<Map<dynamic, dynamic>>(
AdropMethod.requestConsentInfoUpdate);
if (result != null) {
listener(AdropConsentResult.fromMap(result));
} else {
listener(AdropConsentResult(
status: AdropConsentStatus.unknown,
canRequestAds: false,
canShowPersonalizedAds: false,
error: 'No result returned',
));
}
} catch (e) {
log('Error requesting consent info update: $e',
name: 'AdropConsentManager');
listener(AdropConsentResult(
status: AdropConsentStatus.unknown,
canRequestAds: false,
canShowPersonalizedAds: false,
error: e.toString(),
));
}
}