Skip to main content

go_trust_mobile_sdk 1.0.5 copy "go_trust_mobile_sdk: ^1.0.5" to clipboard
go_trust_mobile_sdk: ^1.0.5 copied to clipboard

A Flutter mobile SDK for GoTrust consent and preference management.


GoTrust Flutter SDK (go_trust_mobile_sdk) #

The GoTrust Flutter SDK enables cross-platform mobile applications to present consent-collection forms and preference centers natively within Flutter UI trees for compliant privacy and consent management.


Requirements #

Platform / Dependency Minimum Version
Flutter SDK ^3.19.0
Dart SDK ^3.3.0
Android minSdkVersion 24
iOS iOS 14.0 or higher
Package Source pub.dev/packages/go_trust_mobile_sdk

Integration Guide #

Step 1: Add SDK Dependency #

Add the latest version of go_trust_mobile_sdk to your project's pubspec.yaml file:

dependencies:
  flutter:
    sdk: flutter
  go_trust_mobile_sdk: ^<latest-version>

Fetch the package via CLI:

flutter pub get


Step 2: Configure Environment Parameters #

Store tenant credentials securely using environment configurations or remote configuration services rather than hardcoding them inside UI widgets.

abstract class GoTrustConfig {
  static const String baseUrl = "https://www.yourdomain.com";
  static const String consentId = "YOUR_SOURCE_ID";
  static const String preferenceFormId = "YOUR_PREFERENCE_FORM_ID";
  static const String customerId = "YOUR_CUSTOMER_ID";
}


Step 3: Define Subject Identity & Parameters #

Declare the target subject's identity as key-value pairs matching your GoTrust dashboard field configuration (e.g., "107" for phone, "10085" for email).

// Required: Subject identity key-value map
static const Map<String, dynamic> subjectIdentityValues = {
  "XXX": "XXXXXXXXXX",
  "XXY": "YYYYYYYYYY",
};

// Optional: Extra prefill data (not used for identity lookup)
static const Map<String, dynamic> additionalParams = <String, dynamic>{
  "YYYY": "ZZZZZZ",
  "XX": "XXXXXXXX",
};


Step 4: Implementation & Flow Control #

Important

Always execute the consent check before presenting the UI to avoid unnecessary popups when a valid consent record already exists.

Use GoTrustSdkHelper.showConsentForm to verify if the consent form should be rendered for the specified subject identity.

final bool shouldShowConsent = await GoTrustSdkHelper.showConsentForm(
  GoTrustConfig.consentId,
  subjectIdentityValues,
  GoTrustConfig.baseUrl,
);

  • true: No valid record found; present ConsentFormPage.
  • false: Valid consent already on record; skip display.

If consent is required, navigate to ConsentFormPage:

if (shouldShowConsent && context.mounted) {
  Navigator.push(
    context,
    MaterialPageRoute(
      builder: (_) => ConsentFormPage(
        baseUrl: GoTrustConfig.baseUrl,
        sourceId: GoTrustConfig.consentId,
        initialSubjectValues: subjectIdentityValues,
        additionalParams: additionalParams,
        showCrossButton: false,
        enableCaptcha: true,
        onSuccess: (int? statusCode, String? message, List<Map<String, dynamic>>? data) {
          // Triggered upon successful form submission
        },
        onError: (int? statusCode, String? message) {
          // Triggered on failure; screen remains active for retry
        },
        onClose: (String? message) {
          // Triggered when dismissed without submitting
        },
      ),
    ),
  );
}

3. Render Preference Center

Present LoginPage to allow users to update their stored preferences from app settings:

void openPreferenceCenter(BuildContext context) {
  Navigator.push(
    context,
    MaterialPageRoute(
      builder: (_) => LoginPage(
        baseUrl: GoTrustConfig.baseUrl,
        cutomerId: GoTrustConfig.customerId,
        preferenceFormId: GoTrustConfig.preferenceFormId,
        consentId: GoTrustConfig.consentId,
        initialSubjectValues: subjectIdentityValues,
        additionalParams: additionalParams,
        enableCaptcha: true,
        onSuccess: (String? message, List<Map<String, dynamic>>? data) {
          // Preferences successfully updated
        },
        onError: (String? message) {
          // Preference update failed
        },
        onClose: (String? message) {
          // Preference center closed without saving
        },
      ),
    ),
  );
}


Parameter Reference #

Parameter Type Requirement Description
baseUrl String Required Target API environment domain URL.
consentId / sourceId String Required Unique consent form source identifier.
initialSubjectValues Map<String, dynamic> Required Key-value pairs matching dashboard field IDs identifying the user.
additionalParams Map<String, dynamic> Optional Supplementary key-value pairs for form field prefilling.
showCrossButton bool Optional Toggles dismiss button visibility (default: true).
enableCaptcha bool Optional Toggles CAPTCHA verification on submit/save.
pfToken String Optional Preference center access token (alternative to preferenceFormId and customerId).
customerId String Conditional Customer ID for Preference Center authentication.
preferenceFormId String Conditional Preference Form ID for Preference Center lookup.

Troubleshooting & Best Practices #

  • Prevent Duplicate Presentation: Maintain a local state flag (e.g., bool _isFormActive = false) during navigation to prevent triggering multiple modal overlays on rapid taps.
  • Platform-Specific Setup: Verify that both android/app/build.gradle (minSdkVersion 24) and ios/Podfile (platform :ios, '14.0') meet baseline requirements.
  • Identity Key Mapping: Double-check that field ID keys in initialSubjectValues (e.g., "107") match string field IDs generated in the GoTrust Admin Dashboard.

Lifecycle Management & Release SOP #

Document ID: SOP-FLUTTER-SDK-001

Effective Date: August 2026

Subject: GoTrust Flutter SDK Maintenance & Update Cycle

Target Audience: Mobile Engineering & Compliance Teams

1. Purpose & Scope #

The GoTrust Flutter SDK handles privacy compliance across both iOS and Android releases from a single codebase. Because regulatory consent mandates apply universally across platforms, version updates must follow standardized ingestion, verification, and deployment protocols.

2. Update Classifications & SLAs #

Classification Trigger Criteria Action Required
Compliance-Critical Legal/regulatory mandate changes, critical security patches, required flow changes. Fast-track integration. Out-of-band release creation across Android & iOS binaries.
Routine Minor bug fixes, performance updates, non-breaking UI updates, optional API parameters. Ingested into standard engineering backlog and sprint cycles.

3. Release & Integration Workflow #

flowchart TD
    A[GoTrust Package Update Published / Notified] --> B{Assess Classification}
    
    B -->|Compliance-Critical| C[Fast-Track: Out-of-Band Release]
    B -->|Routine| D[Backlog: Standard Sprint Cycle]
    
    C --> E[Step 1: Bump version in pubspec.yaml & run flutter pub get]
    D --> E
    
    E --> F[Step 2: Review pub.dev changelog & parameter updates]
    F --> G[Step 3: Perform Dual-Platform QA in Sandbox]
    
    G --> G1[Android Build Verification - minSdkVersion 24+]
    G --> G2[iOS Build Verification - iOS 14.0+]
    G --> G3[Verify Async Check - GoTrustSdkHelper.showConsentForm]
    G --> G4[Verify ConsentFormPage Navigation & Callbacks]
    G --> G5[Verify Preference Center Flow]
    
    G1 & G2 & G3 & G4 & G5 --> H{Validation Successful?}
    
    H -->|Yes| I[Step 4: Build Release Binaries AAB / IPA & Deploy]
    H -->|No| J[Escalate to GoTrust Support]

4. Operational Execution Guide #

  1. Designate Release Owner: Assign a designated Flutter developer to track package updates and release notes on pub.dev.
  2. Dependency Update:
  • Update pubspec.yaml with the new version constraint.
  • Run flutter pub get and check for any transitive dependency conflicts.
  1. Dual-Platform Testing:
  • Point baseUrl parameters to your staging/sandbox environment.
  • Execute test suites on physical Android/iOS devices or emulators.
  • Confirm callback behavior (onSuccess, onError, onClose) across both OS environments.
  1. App Store & Google Play Deployment:
  • Package release builds via flutter build appbundle and flutter build ipa.
  • Deploy updates according to the prescribed classification SLA (Fast-Track vs. Standard Release).