RelevaClient class

Implemented types

Constructors

RelevaClient(String _realm, String _accessToken, {RelevaConfig? config})
RelevaClient.customClient(Client http, String _realm, String _accessToken, {RelevaConfig? config})

Properties

cartManager CartManager
final
engagementTrackingService EngagementTrackingService?
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
http ↔ Client
getter/setter pair
inbox InboxService
Access the inbox service.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
screenTrackingService ScreenTrackingService?
getter/setter pair
wishlistManager WishlistManager
final

Methods

bannerAction(BannerResponse banner, {String? action}) Future<void>
bannerImpression(BannerResponse banner) Future<void>
clearCartStorage() Future<void>
Clear cart storage without triggering an API call Use this after checkout success to prevent stale cart data from being sent on subsequent screen views Resets initialization flag so next cart update is treated as initialization (no automatic push) Marks cart as changed so next screen view tracks the cart state change
createScreenTrackingService() ScreenTrackingService
dispose() → void
Releases resources held by this client. Call when the client is no longer needed to cancel any pending NPS delay timers.
enablePushEngagementTracking({required dynamic onNotificationTapped(RelevaNotificationAction)}) Future<void>
Enable push notification engagement tracking.
inboxDeleteMessage(String messageId) Future<void>
override
inboxFetchMessages({int limit = 20, String? cursor}) Future<Map<String, dynamic>>
override
inboxFetchUnreadCount() Future<int>
override
inboxMarkAllAsRead() Future<void>
override
inboxMarkAsRead(String messageId) Future<void>
override
inboxTrackAction(String messageId) Future<void>
override
initializeInbox() Future<void>
Initialize the inbox service. Call after setProfileId(). Fetches the first page of messages and the unread count.
isRelevaMessage(RemoteMessage message) bool
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
push(PushRequest request) Future<RelevaResponse>
registerPushToken(DeviceType type, String token) Future<void>
setAppVersion(String appVersion) → void
Set the running app's version string (semver, e.g. "3.2.1"). Used in the NPS push context for server-side version filtering.
setCart(Cart cart) Future<void>
Set cart Automatically sends a push request with updated cart and wishlist state if cart was previously initialized
setDeviceId(String deviceId) Future<void>
setEndpointOverride(String? url) → void
Override the API endpoint URL. When set, all API calls use this URL instead of the realm-based default (e.g. for local development with ngrok). Pass null to clear the override and revert to the default.
setProfileId(String profileId, [bool skipMergeWithPreviousProfileId = false]) Future<void>
setWishlist(Iterable<WishlistProduct> wishlistProducts) Future<void>
Set wishlist Automatically sends a push request with updated cart and wishlist state if wishlist was previously initialized
storyAction(StoryResponse story, {required String action, dynamic slideId}) Future<void>
storyImpression(StoryResponse story) Future<void>
submitNpsResponse({required String token, required int score, String? comment}) Future<void>
Submits an NPS survey response to the server. Failures are swallowed with one retry — the thank-you screen is shown regardless of network outcome (per spec).
toString() String
A string representation of this object.
inherited
trackCheckoutSuccess({String? screenToken, String? pageUrl, required Cart orderedCart, String? userEmail, String? userPhoneNumber, String? userFirstName, String? userLastName, DateTime? userRegisteredAt, String? locale, String? currency}) Future<RelevaResponse>
trackCustomEvent({String? screenToken, String? pageUrl, required List<CustomEvent> customEvents, String? locale, String? currency}) Future<RelevaResponse>
trackEngagement(RemoteMessage message) Future<void>
trackEvent(String eventName) → void
Notify the SDK of a named app event. Used for:
trackProductView({String? screenToken, String? pageUrl, required String productId, Map<String, dynamic>? customFields, List<String>? categories, String? locale, String? currency}) Future<RelevaResponse>
trackScreenView({String? screenToken, String? screenName, String? pageUrl, List<String>? productIds, List<String>? categories, AbstractFilter? filter, Map<String, List<String>>? blocks, String? locale, String? currency}) Future<RelevaResponse>
trackSearchView({String? screenToken, String? pageUrl, String? query, List<String>? resultProductIds, AbstractFilter? filter, Map<String, List<String>>? blocks, String? locale, String? currency}) Future<RelevaResponse>

Operators

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