SDKInstance class
Internal singleton that backs the public Digia static facade.
This is an implementation detail of the SDK. App developers never see or reference this class — all calls flow through Digia.
- Implemented types
- Mixed-in types
Properties
-
allCampaigns
→ List<
CampaignModel> -
All campaigns currently cached in the store. Exposed for host/dev tooling
(e.g. the medihub "campaign lab" screen) to enumerate fetched campaigns.
no setter
- analyticsQueueForTesting → SqliteAnalyticsQueue?
-
no setter
- anchorRegistry → AnchorRegistry
-
no setter
-
campaignFetchForTesting
→ Future<
void> -
Completes when the campaign fetch started by initialize has settled
the SDK state (ready or failed). Tests await it instead of guessing.
no setter
-
captureBubbleHiddenNotifier
→ ValueNotifier<
bool> -
final
-
captureFlashNotifier
→ ValueNotifier<
int> -
final
-
captureMediaNotifier
→ ValueNotifier<
bool> -
final
-
captureModeNotifier
→ ValueNotifier<
bool> -
Capture controls are debug-only and independent from Sync.
final
-
captureStructureNotifier
→ ValueNotifier<
bool> -
final
-
captureTextNotifier
→ ValueNotifier<
bool> -
final
- clockForTesting ↔ int Function()?
-
Replaces the session clock (epoch milliseconds) in tests, so a test can
simulate a day. Null, the default, keeps the system clock.
getter/setter pair
- controller → DigiaOverlayController
-
Controller for inline campaigns, notifies when they change.
Exposed so DigiaHost can subscribe at mount time.
no setter
- currentScreen → String?
-
no setter
- events → EngageEventEmitter
-
Experience-event emitter used by render surfaces (DigiaSlot,
DigiaHost, nudge widgets) to route lifecycle events to CEP and/or Digia.
no setter
- floaterStoryOrchestrator → FloaterStoryOrchestrator
-
no setter
- floaterStoryReporter → FloaterStoryReporter
-
no setter
- guideManager → GuideShowcaseManager
-
no setter
- guideOrchestrator → GuideOrchestrator
-
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- inlineReporter → InlineReporter
-
no setter
- isReady → bool
-
Whether core is READY, so deliver routes instead of dropping.
no setteroverride
-
no setter
- networkClientFactoryForTesting ↔ NetworkClientFactory?
-
Replaces the SDK's network client in tests. The production client is a
DioNetworkClient that owns its whole engine configuration.
getter/setter pair
- nudgeOrchestrator → NudgeOrchestrator
-
no setter
- pipOrchestrator → PipOrchestrator
-
no setter
- pipReporter → PipReporter
-
no setter
- presentations → PresentationCoordinator
-
Internal accessor for tests and host tooling. Never app-facing.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
sdkConfigFetchForTesting
→ Future<
void> -
no setter
- sdkState → SDKState
-
no setter
-
servicesListenable
→ ValueListenable<
SDKServices?> -
Changes whenever the services are assigned or replaced, so a widget built
before initialize finished picks them up when they appear.
no setter
- servicesOrNull → SDKServices?
-
Core SDK services, or null until initialize has built them.
no setter
- storyReporter → StoryReporter
-
no setter
-
successfulCapturePagesNotifier
→ ValueNotifier<
List< String> > -
final
- surveyOrchestrator → SurveyOrchestrator
-
no setter
- surveyReporter → SurveyReporter
-
no setter
- themeMode → DigiaThemeMode
-
no setter
- waitClockForTesting ↔ int Function()?
-
Replaces
_sleepClockin tests, where timers run on fake time.getter/setter pair
Methods
-
anchorExposed(
String anchorKey) → void -
Called by DigiaAnchor each time the anchor becomes exposed (see
SlotExposure): every return to its screen or scroll into view is an appearance, so the signal is not deduplicated. -
bindSurveyProgress(
int token, ({int? abandonedAtItem, int? answeredCount}) read()?) → void -
campaignForPayload(
CEPTriggerPayload payload) → CampaignModel? -
Looks up the campaign for
payload(live test entry if present, else the real cache). Used by inline surfaces to attach campaign context. -
captureCurrentPage(
TextDirection textDirection) → Future< String> -
clearAllInlineContent(
) → void - Clears all inline content (carousels/stories) across every placement.
-
clearInlineContent(
List< String> placementKeys) → void -
Clears inline content (carousels/stories) for each key in
placementKeys. Once loaded, inline content is retained indefinitely — hosts should call this on logout so a stale user's content doesn't linger across the account switch. No-op ifplacementKeysis empty. The app removes it, so it is reported cancelled, not as a user close. -
clearUserId(
) → Future< void> -
deliver(
CEPTriggerPayload trigger) → CampaignPresentation -
Delivers a CEP trigger into the Digia engine.
override
-
didChangeAccessibilityFeatures(
) → void -
Called when the system changes the set of currently active accessibility
features.
inherited
-
didChangeAppLifecycleState(
AppLifecycleState state) → void -
Called when the system puts the app in the background or returns
the app to the foreground.
override
-
didChangeLocales(
List< Locale> ? locales) → void -
Called when the system tells the app that the user's locale has
changed. For example, if the user changes the system language
settings.
inherited
-
didChangeMetrics(
) → void -
Called when the application's dimensions change. For example,
when a phone is rotated.
inherited
-
didChangePlatformBrightness(
) → void -
Called when the platform brightness changes.
inherited
-
didChangeTextScaleFactor(
) → void -
Called when the platform's text scale factor changes.
inherited
-
didChangeViewFocus(
ViewFocusEvent event) → void -
Called whenever the PlatformDispatcher receives a notification that the
focus state on a view has changed.
inherited
-
didHaveMemoryPressure(
) → void -
Called when the system is running low on memory.
inherited
-
didPopRoute(
) → Future< bool> -
Called when the system tells the app to pop the current route, such as
after a system back button press or back gesture.
inherited
-
didPushRoute(
String route) → Future< bool> -
Called when the host tells the application to push a new route onto the
navigator.
inherited
-
didPushRouteInformation(
RouteInformation routeInformation) → Future< bool> -
Called when the host tells the application to push a new
RouteInformation and a restoration state onto the router.
inherited
-
didRequestAppExit(
) → Future< AppExitResponse> -
Called when a request is received from the system to exit the application.
inherited
-
dwellElapsedMs(
String cepCampaignId) → int? -
Milliseconds since
cepCampaignId's surface was marked visible, for callers that must stamptime_to_action_msat the moment of the tap rather than when they get around to reporting it. -
failNudgePresentation(
CEPTriggerPayload payload, DropReason reason, String detail, {Object? error}) → void - A nudge DigiaHost could not present (no navigator, or the present threw): nothing reached the screen, so it leaves the surface and settles as a drop now rather than blocking every later campaign.
-
floaterStoryActionScope(
BuildContext context) → EngageActionScope - Action bindings for content inside a story floater.
-
flushAnalytics(
) → Future< void> -
getAnonymousId(
) → String -
handleCancelBackGesture(
) → void -
Called when a predictive back gesture is canceled, indicating that no
navigation should occur.
inherited
-
handleCommitBackGesture(
) → void -
Called when a predictive back gesture is finished successfully, indicating
that the current route should be popped.
inherited
-
handleLiveTestCampaign(
LiveTestInvocation invocation) → void -
Handles one
campaign_testSSE event: ACKsreceived, then routes the campaign through the same CampaignRouter an organic CEP trigger uses, with the live-test driver. -
handleStartBackGesture(
PredictiveBackEvent backEvent) → bool -
Called at the start of a predictive back gesture.
inherited
-
handleStatusBarTap(
) → void -
Called when the user taps the status bar on iOS, to scroll a scroll
view to the top.
inherited
-
handleUpdateBackGestureProgress(
PredictiveBackEvent backEvent) → void -
Called when a predictive back gesture moves.
inherited
-
initialize(
DigiaConfig config) → Future< void> -
Returns when the campaign fetch has settled the SDK state (ready or
failed) or
_initializeCapafter the call, whichever comes first. Never throws: a failure leaves the SDK in SDKState.failed. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onHostMounted(
) → void - Called by DigiaHost when it mounts into the widget tree.
-
onHostUnmounted(
) → void - Called by DigiaHost when it is removed from the widget tree.
-
openDebugSettingsFromOverlay(
) → Future< void> -
Pushes the debug settings screen from DigiaRecordingBadge, which lives
above the app's own Navigator (inside DigiaHost's
Stack, same as_presentNudge) — so it can't resolveNavigator.of(context)from its own BuildContext and must go through_navigatordirectly instead of the BuildContext-basedDigia.openDebugSettings. -
pipActionScope(
BuildContext context) → EngageActionScope - Action bindings for buttons inside the expanded PiP content.
-
pushDebugSettingsRoute(
) → Future< void> - Pushes the debug settings screen, at most one at a time.
-
recordAnchorSeen(
String anchorKey) → void - Called by DigiaAnchor each time an anchor key mounts. Records it against the current screen (see setCurrentScreen); one mounted before any screen is set is buffered until a screen is.
-
recordSlotSeen(
String placementKey) → void - Called by DigiaSlot each time a placement key mounts.
-
register(
DigiaCEPPlugin plugin) → void -
reportAnchorlessGuideFailure(
int guideToken, DiagnosticReason code, String message, {Map< String, Object> dropDetail = const {}}) → void -
resetForTesting(
{SDKServices? services}) → void -
resolveActiveCampaign(
) → CampaignModel? - Resolves the CampaignModel for the active payload so DigiaHost can switch on its config type and present the correct experience. Returns null (and auto-dismisses) when no matching campaign is found.
-
setCampaignsSuppressed(
bool suppressed) → void - Suppresses overlay campaigns while the host app shows UI of its own — typically its own modal — that a campaign must not cover. See Digia.setCampaignsSuppressed.
-
setCaptureModeEnabled(
bool enabled) → Future< void> -
setCaptureProfile(
{bool? includeText, bool? includeImagesAndMedia, bool? includeOtherStructuralNodes}) → Future< void> -
setCurrentScreen(
String name) → void - Sets the current screen. This is the single source of truth for screen scoping — a PiP belongs to the screen named here when it opened, and ends when this reports a different one. That is the expected end of most PiP impressions, not an error path.
-
setCustomKVHandler(
FutureOr< void> handler(Map<String, String> payload)?) → void -
setDeepLinkHandler(
FutureOr< void> handler(String deepLink)?) → void -
setOpenURLHandler(
FutureOr< void> handler(String deepLink)?) → void -
setServicesForTesting(
SDKServices services) → void -
setThemeMode(
DigiaThemeMode themeMode) → void - Selects the theme used when Campaign Canvas colors are rendered.
-
setUserAttributes(
Map< String, dynamic> attributes) → Future<void> - Supplies attributes about the current user, for campaigns to interpolate.
-
setUserId(
String userId, {String? userHash}) → Future< void> -
Buffered until the services exist — not merely until initialize has
been called: a host's unawaited
initialize()followed bysetUserId()lands while they are still being built (review B6). -
slotExposed(
String placementKey) → void - Called by DigiaSlot each time the slot becomes exposed; as anchorExposed.
-
toString(
) → String -
A string representation of this object.
inherited
-
trackEvent(
String eventName, {Map< String, Object?> properties = const {}}) → Future<void> - Records an event the app performed, such as a purchase.
-
triggerCampaign(
String campaignKey, {Map< String, String> ? variables}) → CampaignPresentation -
Delivers a campaign the host app asked for by key, with no CEP involved —
parity with Android/iOS
triggerCampaign. Digia-internal: not on the publicDigiaAPI. Mints ahost:<uuid>id, since no CEP supplies one.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- idGenerator ↔ String Function()
-
Mints presentation ids.
getter/setter pair
- instance → SDKInstance
-
Internal accessor used only by Digia and DigiaHost.
no setter