changePrivacyPreferences method
Opens the privacy preferences screen for the user to manage consent. Returns a Future
Implementation
Future<bool> changePrivacyPreferences(List<String>? testDeviceIds) async {
final completer = Completer<bool>();
ConsentInformation.instance.requestConsentInfoUpdate(
ConsentRequestParameters(),
() async {
if (await ConsentInformation.instance.isConsentFormAvailable()) {
ConsentForm.loadConsentForm(
(consentForm) {
consentForm.show((formError) async {
// Continue with initialization after consent form is shown.
await _initialize(testDeviceIds);
completer.complete(true);
log('');
});
},
(formError) {
// Handle error loading consent form.
completer.complete(false);
},
);
} else {
completer.complete(false);
}
},
(error) {
// Handle error during consent info update.
completer.complete(false);
},
);
return completer.future;
}