Skip to main content

Overview

Presentum provides several ways to manage state. Guards are the primary tool, but you can also use direct state changes for immediate user actions.

Basic state change

context.presentum<CampaignItem, AppSurface, CampaignVariant>().setState((state) {
  state.setActive(AppSurface.homeTopBanner, campaignItem);
  state.enqueue(AppSurface.profileAlert, alertItem);
  return state;
});

Declarative API

You can do anything with state:
// Push to surface
await presentum.pushSlot(AppSurface.homeTopBanner, item: campaignItem);

// Mark events
await presentum.markShown(item);
await presentum.markDismissed(item);
await presentum.markConverted(item);

// Remove items
await presentum.removeById('campaign-123');
Guards should be your primary tool for scheduling presentations, removing ineligible items, periodic refreshes, and complex eligibility rules. Use direct state changes when you need explicit control.
Learn more about state structure ->