Apphud class
Properties
hashCode
→ int
The hash code for this object.
no setter inherited
runtimeType
→ Type
A representation of the runtime type of the object.
no setter inherited
Methods
noSuchMethod (Invocation invocation )
→ dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString ()
→ String
A string representation of this object.
inherited
Static Methods
addAttribution ({Map <String , dynamic > ? data , required ApphudAttributionProvider provider , String ? identifier })
→ Future <bool >
Submit attribution data to Apphud from your attribution network provider.
collectDeviceIdentifiers ()
→ Future <void >
Android only. Collects device identifiers that are required for some third-party integrations,
like AppsFlyer, Adjust, Singular, etc.
collectSearchAdsAttribution ()
→ Future <ApphudError ? >
iOS only. Send search ads attribution data to Apphud.
deviceID ()
→ Future <String >
Returns current device ID.
enableDebugLogs ({ApphudDebugLevel level = ApphudDebugLevel.low })
→ Future <void >
Enables debug logs. You should call this method before SDK initialization.
fetchPlacements ()
→ Future <ApphudPlacements >
Returns the placements from Product Hub > Placements, potentially altered
based on the user's involvement in A/B testing, if any.
grantPromotional ({required int daysCount , String ? productId , ApphudGroup ? group })
→ Future <bool >
You can grant free promotional subscription to user. Returns true
in a callback if promotional was granted.
hasActiveSubscription ()
→ Future <bool >
Returns true
if user has active subscription. Value is cached on device.
hasPremiumAccess ()
→ Future <bool >
Returns true
if user has active subscription or non renewing purchase (lifetime).
incrementUserProperty ({required ApphudUserPropertyKey key , required dynamic by })
→ Future <void >
Increment custom user property. Value must be one of: int
, float
isNonRenewingPurchaseActive (String productIdentifier )
→ Future <bool >
Returns true
if current user has purchased standard in-app purchase with given productIdentifier
.
logout ()
→ Future <void >
Logs out current user, clears all saved data and resets SDK to uninitialized state.
nonRenewingPurchases ()
→ Future <List <ApphudNonRenewingPurchase > >
Returns an array of all standard in-app purchases (consumables, non-consumables or non-renewing subscriptions) that this user has ever purchased.
optOutOfTracking ()
→ Future <void >
Android only. Must be called before SDK initialization.
paywallClosed (ApphudPaywall paywall )
→ Future <void >
Call this method when your paywall screen is dismissed without a purchase.
This is required for A/B testing analysis.
paywalls ()
→ Future <ApphudPaywalls ? >
Asynchronously retrieves paywalls from Product Hub > Paywalls,
potentially altered based on the user's involvement in A/B testing, if any.
Each paywall contains an array of ApphudProduct
objects that
can be used for purchases.
ApphudProduct
is Apphud's wrapper around native Stores products.
paywallsDidLoadCallback ()
→ Future <ApphudPaywalls >
Retrieves the paywalls configured in Product Hub > Paywalls,
potentially altered based on the user's involvement in A/B testing, if any.
Awaits until the inner Stores products are loaded from the App Store or Google Play.
paywallShown (ApphudPaywall paywall )
→ Future <void >
Call this method when your paywall screen is displayed to the user.
This is required for A/B testing analysis.
permissionGroups ()
→ Future <List <ApphudGroup > >
Returns permission groups configured in Apphud dashboard > Product Hub > Products. Groups are cached on device.
placement (String identifier )
→ Future <ApphudPlacement ? >
Asynchronously retrieves a specific paywall placement by its identifier
configured in Product Hub > Placements, potentially altered based on the user's involvement in A/B testing, if any.
Awaits until the inner Stores products are loaded from the App Store or Google Play.
placements ()
→ Future <List <ApphudPlacement > >
Asynchronously retrieves the paywall placements configured in Product Hub > Placements,
potentially altered based on the user's involvement in A/B testing, if any.
Awaits until the inner Stores products are loaded from the App Store or Google Play.
presentOfferCodeRedemptionSheet ()
→ Future <void >
Displays an offer code redemption sheet.
product (String productIdentifier )
→ Future <ApphudProductComposite ? >
Returns ApphudProductComposite
object by productIdentifier
.
products ()
→ Future <List <ApphudProductComposite > >
Returns array of ApphudProductComposite objects that you added in Apphud > Product Hub > Products.
purchase ({String ? productId , ApphudProduct ? product , String ? offerIdToken , String ? oldToken , int ? replacementMode })
→ Future <ApphudPurchaseResult >
Purchase product and automatically submits App Store Receipt (iOS) or Google Play purchase token (Android) to Apphud.
purchasePromo ({required String productId , required String discountID })
→ Future <ApphudPurchaseResult >
This method automatically sends in-app purchase receipt to Apphud, so you don't need to call submitReceipt
method.
rawPaywalls ()
→ Future <ApphudPaywalls ? >
A list of paywalls, potentially altered based on the user's involvement in A/B testing, if any.
rawPlacements ()
→ Future <List <ApphudPlacement > >
A list of paywall placements, potentially altered based on the user's involvement in A/B testing, if any.
A placement is a specific location within a user's journey (such as onboarding, settings, etc.)
where its internal paywall is intended to be displayed.
refreshUserData ()
→ Future <void >
Android only. Refreshes current user data, which includes:
restorePurchases ()
→ Future <ApphudComposite >
Implements Restore Purchases
mechanism. Basically it just sends current
App Store Receipt (iOS) or Google Play Purchase Tokens (Android) to Apphud and returns subscriptions info.
setAdvertisingIdentifier (String idfa )
→ Future <void >
iOS only. Submit Advertising Identifier (IDFA) to Apphud.
setListener ({ApphudListener ? listener })
→ Future <void >
Set listener
setUserProperty ({required ApphudUserPropertyKey key , dynamic value , bool setOnce = false })
→ Future <void >
Set custom user property. Value must be one of: int
, float
, bool
, String
, null
.
Example:
start ({required String apiKey , String ? userID , bool ? observerMode })
→ Future <ApphudUser >
Initializes Apphud SDK. You should call it during app launch.
startManually ({required String apiKey , String ? userID , String ? deviceID , bool ? observerMode })
→ Future <ApphudUser >
Initializes Apphud SDK with User ID & Device ID pair. Not recommended for use unless you know what you are doing.
subscription ()
→ Future <ApphudSubscriptionWrapper ? >
Returns ApphudSubscriptionWrapper
subscription object that current user has ever purchased. Subscriptions are cached on device.
subscriptions ()
→ Future <List <ApphudSubscriptionWrapper > >
Returns an array of all subscriptions that this user has ever purchased. Subscriptions are cached on device.
syncPurchasesInObserverMode ()
→ Future <void >
Android only. This method will send purchases to the Apphud server.
updateUserID (String userID )
→ Future <void >
Updates user ID value.
userID ()
→ Future <String >
Returns current user ID.