Flutter

The following documentation outlines the APIs available for use in the TrustArc Mobile Consent SDK for Flutter.

FlutterTrustarcMobileConsentSdk Class

The FlutterTrustarcMobileConsentSdk class is the main entry point for interacting with the TrustArc SDK.

Constructor

ConstructorDescription
FlutterTrustarcMobileConsentSdk()Provides methods for interacting with the TrustArc SDK

Initialization Methods

MethodsDescriptionParametersReturn
initializeInitializes the TrustArc SDK.sdkMode: SdkModeFuture
startStarts the TrustArc SDK. Supports backward-compatible calling forms.domainName: String, country: String, [state] or [language, state]Future
isSdkInitializedValidates if SDK setup is finished.NoneFuture
subscribeSubscribes to SDK events.onSdkInitFinish, onConsentChanges, onGoogleConsentChangesvoid

Consent Management Methods

MethodsDescriptionParametersReturn
openCMManually opens the consent window.NoneFuture
useGdprDetectionOverrides behavior to Expressed mode for startup checks.enable: boolFuture
setUnifiedConsentContextSets Unified Consent context key (domain resolved from start(...)).key: String (required named param)Future
setUnifiedConsentIdentitySets Unified Consent identity with user id + HMAC.userId: String, hmac: StringFuture
enableAppTrackingTransparencyPromptEnables/disables ATT prompt on iOS (no-op on Android).enabled: boolFuture
setBackgroundWebViewVisibleShows/hides background WebView for debugging.visible: boolFuture
clearAllConsentDataClears stored consent data/preferences.NoneFuture

Information Retrieval Methods

MethodsDescriptionParametersReturn
getStoredConsentDataRetrieves stored consent data.NoneFuture
getConsentDataByCategoryRetrieves consent data grouped by category.NoneFuture
getCategoryConsentRetrieves consent value for a specific category index.categoryIndex: intFuture<String?>
isCategoryConsentedChecks if a specific category is consented.categoryIndex: intFuture
getWebScriptRetrieves web script for web integration.NoneFuture
isConsentPresentChecks if consent is present.NoneFuture
getConsentValueRetrieves consent value for a specific tracker.trackerId: StringFuture
getTrustArcDeviceUUIDRetrieves consent identifier for the device.NoneFuture
getLastConsentRetrieves timestamp of last consent update.NoneFuture
getConsentLanguageRetrieves language used by the SDK.NoneFuture
getGoogleConsentsRetrieves Google consent payload.NoneFuture
getBehaviorRetrieves consent behavior setting.NoneFuture
getSharedPreferencesRetrieves native shared preference values.NoneFuture<Map<String, dynamic>>
getIABTCFPreferencesRetrieves IAB TCF preferences.NoneFuture
getTcfStringRetrieves TC string (deprecated; use getSharedPreferences().IABTCF_TCString).NoneFuture
getTrackingAuthorizationStatusGets ATT authorization status (iOS); Android returns notApplicable.NoneFuture
isConsentExpiredChecks if stored consent has expired.NoneFuture
getConsentExpiryDateRetrieves stored expiry timestamp (deprecated).NoneFuture<int?>
getStoredConsentExpiryRetrieves stored expiry timestamp in milliseconds.NoneFuture<int?>

Debug and Testing Methods

MethodsDescriptionParametersReturn
generateHmacAuthIdTesting-only helper to generate HMAC auth id for Unified Consent workflows.userId: String, key: StringFuture<String?>
enableDebugLogEnables/disables debug logging.enabled: boolFuture

SdkMode Enum

Defines the mode in which the SDK operates.

PropertyTypeDescription
standardStringStandard consent collection mode
iabTCFv_2_2StringIAB TCF compliant layout mode

IABTCFPreferences

Represents IAB Transparency & Consent Framework preferences.

FieldDescription
IABTCF_PurposeOneTreatmentIndicates if Purpose One has special treatment (0 = no, 1 = yes)
IABTCF_VendorConsentsEncoded string representing vendor consents
IABTCF_enableAdvertiserConsentMode

Whether advertiser consent mode is enabled


 

Google’s latest Firebase SDK release for iOS and Android now supports TCF. To ensure proper consent handling and compatibility with the SDK, please set IABTCF_enableAdvertiserConsentMode to 1 when using TCF so Google can infer consent from the TC string.

IABTCF_PublisherCCPublisher’s country code (e.g., "DE", "FR")
IABTCF_PublisherConsentEncoded string representing publisher-specific consent
IABTCF_gdprAppliesIndicates if GDPR applies (0 = no, 1 = yes)
IABTCF_SpecialFeaturesOptInsEncoded string representing special feature opt-ins
IABTCF_VendorLegitimateInterestsEncoded string representing vendor legitimate interests
IABTCF_PublisherLegitimateInterestsEncoded string representing publisher legitimate interests
IABTCF_PublisherCustomPurposesConsentsEncoded string representing publisher custom purposes consents
IABTCF_TCStringTC string containing the encoded user consent data
IABTCF_UseNonStandardTextsIndicates if non-standard text versions are used (0 = no, 1 = yes)
IABTCF_PolicyVersionIAB TCF policy version number
IABTCF_PurposeConsentsEncoded string representing purpose consents
IABTCF_PurposeLegitimateInterestsEncoded string representing purpose legitimate interests
IABTCF_CmpSdkIDCMP SDK ID
IABTCF_CmpSdkVersionCMP SDK version
IABTCF_PublisherCustomPurposesLegitimateInterestsEncoded string representing publisher custom purposes legitimate interests