Skip to main content

Single Story

info

Starting from SDK version 0.8.0, the call of showing single story has changed. If you are upgrading from older version please see migration guide here.

To show single story in reader by id

InAppStoryManager.instance.showStory(storyId);

To show single story in reader by id if wasn't show already for current user

InAppStoryManager.instance.showStoryOnce(storyId);

With targeting​

Starting with version 0.11.0, you can open a story with targeting evaluation enabled:

InAppStoryManager.instance.showStoryWithTargeting(storyId);

You can also pass request-specific tags to override active tags for this single request without modifying global SDK settings:

InAppStoryManager.instance.showStoryWithTargeting(
storyId,
tags: ['premium', 'promo'],
);
Targeting behavior
  • showStory(storyId) and showStoryOnce(storyId) open the story directly without evaluating targeting rules.
  • showStoryWithTargeting(storyId) evaluates targeting rules against the story. If tags is provided, those tags are used for the request; if tags is null, the globally set SDK tags are used.

Callbacks​

To listen callbacks of result show()/showOnce() implement IASShowStoryCallback mixin and override listeners:

class _WidgetState extends State<T> with IASShowStoryCallback {

void alreadyShown() => print('IASShowStoryCallback.alreadyShown()');


void onError() => print('IASShowStoryCallback.onError()');


void onShow() => print('IASShowStoryCallback.onShow()');
}