OfferManager class

Handle for ZeroSettleKit's ZSOfferManager. Adopters obtain a handle via ZeroSettle.offerManager and use it to drive a fully custom offer UI for both migration and upgrade flows.

State changes from the iOS-side @Published properties are delivered via stateUpdates. Imperative methods (present, dismiss, startCheckout, preloadCheckout, etc.) drive the iOS Kit manager. Adopters should call dispose when the owning widget tears down to release the per-handle channel subscriptions — the iOS-side manager is cached per (userId, stripeCustomerId) and outlives the handle.

Unlike MigrationManager, ZSOfferManager has no onCheckoutFailure closure — checkout errors surface via OfferManagerState.checkoutErrorMessage on the state stream.

Constructors

OfferManager.fromHandleId(String _handleId)

Properties

handleId String
The opaque handle ID issued by the iOS bridge. Exposed for diagnostics (e.g. logging which handle a state event came from).
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stateUpdates Stream<OfferManagerState>
Hot stream of state updates. Emits a coherent snapshot of all five @Published properties on every change. Late subscribers receive the current state on subscribe.
no setter

Methods

dismiss() Future<void>
Dismiss the offer (persists to UserDefaults on iOS).
dispose() Future<void>
Tear down per-handle channel subscriptions. The iOS-side manager instance is NOT released — it's cached per (userId, stripeCustomerId) and survives across handle disposals. Calling ZeroSettle.offerManager again returns a new handle bound to the same underlying state.
getState() Future<OfferManagerState>
Read the current state once.
markCheckoutSucceeded({String? transactionId}) Future<void>
Mark the checkout as succeeded; transitions state toward accepted (when OfferOfferData.needsAppleCancel is true) or completed.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
preloadCheckout({String? stripeCustomerId}) Future<Uri?>
Preload a checkout session for faster presentation. Returns the checkout URL on success, or null when the offer is a web_to_web upgrade (no WebView needed) or preloading failed.
present() Future<void>
Transition the offer into the presented state.
showAppleSubscriptionManagement() Future<void>
Open Apple's subscription management UI for the user to cancel their StoreKit auto-renew. Transitions state toward completed once the system detects the cancellation.
startCheckout({String? stripeCustomerId}) Future<Uri?>
Start the web checkout flow. Returns the checkout URL or null on failure (or for web_to_web upgrades, which complete server-side with no WebView). Errors are exposed via OfferManagerState.checkoutErrorMessage on the state stream.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

isPermanentlyDismissed({required String userId}) Future<bool>
Whether the user has permanently dismissed the offer (UserDefaults).
resetDismissedState() Future<void>
Reset dismissed state for ALL users (debug-only).
setDismissed(bool dismissed, {required String userId}) Future<void>
Set the dismissed flag for userId.