Skip to main content

Example App — Flutter SDK

In-app messaging E2E test harness. Configure the SDK, identify a test user, switch logical screens, and sync in-app messages.

Prerequisites​

  • Flutter SDK installed
  • Your CDP API key and gateway URL

Step 1 — Run the app​

git clone https://github.com/opencdp/opencdp-flutter-sdk.git
cd opencdp-flutter-sdk/example
flutter pub get
flutter run

Step 2 — Configure on first launch​

On the Configure the SDK screen, enter:

FieldValue
CDP endpointYOUR_DATA_GATEWAY_URL (from workspace Settings)
CDP API keyYOUR_CDP_API_KEY
Test person iduser_123 (any non-email ID)
Profile fieldsOptional identify properties

Tap Initialize & continue.

Step 3 — Use the home screen​

The status panel shows your person ID and current logical screen.

ActionPurpose
Bottom tabs (Home, Cart, Profile, Inbox, Events)Change logical screen for page rules
Sync nowManual in-app sync
Reset local stateClear local dismiss/session state
Events tabFire custom track() events

Render types in the example​

render_typeWhere it appears
modalFull-screen dialog via InAppHost
bannerTop overlay via InAppHost
inlineInline list on Home/Cart/Profile tabs
inbox_cardSame inline list; use Inbox tab for inbox-style tests

Step 4 — Test in-app from dashboard​

  1. Note the person ID on the status panel.
  2. Create or trigger an in-app campaign targeting that person.
  3. Tap Sync now or wait for automatic delivery (enableInAppMessages: true).
  4. Render inline/inbox messages and confirm metrics.

Step 5 — Push testing​

This example focuses on in-app messaging. For push:

  1. Wire Firebase/APNs in your host app.
  2. Call registerDeviceToken after identify.
  3. Use the same person ID in Test push notification → Test by User ID.

See Push notifications and Mobile E2E guide.

Verify it worked​

  • Status panel shows person ID and screen name
  • With debug: true, console shows sync URLs containing person_id=your_test_id
  • In-app messages appear after campaign trigger + sync