setDefaultConsent method

Future<void> setDefaultConsent(
  1. bool allowed
)

Implementation

Future<void> setDefaultConsent(bool allowed) async {
  Map<String, Object> collectConsents = allowed
      ? {
          "collect": {"val": "y"}
        }
      : {
          "collect": {"val": "n"}
        };
  Map<String, Object> currentConsents = {"consents": collectConsents};
  Map<String, Object> defaultConsents = {"consents.default": currentConsents};

  MobileCore.updateConfiguration(defaultConsents);
}