translateConsentMap function

Map<GoogleConsentType, GoogleConsentStatus> translateConsentMap(
  1. Map<String, String> consentMap
)

Implementation

Map<GoogleConsentType, GoogleConsentStatus> translateConsentMap(
    Map<String, String> consentMap) {
  final Map<GoogleConsentType, GoogleConsentStatus> translatedMap = {};

  consentMap.forEach((key, value) {
    final consentType = _googleConsentTypeMap[key.toUpperCase()];
    final consentStatus = _googleConsentStatusMap[value.toUpperCase()];

    if (consentType != null && consentStatus != null) {
      translatedMap[consentType] = consentStatus;
    }
  });

  return translatedMap;
}