Skip to main content

Background

Get set up with the Helium SDK for Flutter. Reach out over your Helium slack channel or email founders@tryhelium.com for any questions.
The Helium Flutter SDK currently supports iOS only. Android support is expected mid- to late-November.

Installation

The minimum version of Flutter supported by this SDK is 3.24.0.
To add the Helium package, run:
Or if you prefer, you can add the helium_flutter package to your pubspec.yaml:
then run:
Recommended - Make sure that Swift Package Manager support is enabled:
See this Flutter documentation for more details about Swift Package Manager.
You can still use Cocoapods for your dependencies if preferred. If you need to disable Swift Package Manager dependencies after having enabled it, refer to that same Flutter documentation.

iOS Settings

Helium requires iOS 15+. If your app already has a minimum of iOS 15 or higher, you’re all set. This can be specified in your ios/Podfile with:
If you still see errors related to minimum iOS version, consider updating to 15.0 or higher directly in the Xcode project.

Initialize Helium

In your app’s initialization code (typically in main.dart or your root widget), add the following to configure Helium and prepare your paywalls:
Including a fallback option is highly recommended. See the Fallbacks section on this page.
initialize
method
You can set a custom user ID and custom user traits with the initialize method or by calling:
Set these values before or during initialize to ensure consistency in analytics events and for the best experimentation results.
In most cases there is no need to check download status. Helium will display a loading indication if a paywall is presented before download has completed.
After initialization, you can check the status of the paywalls download:
The download status will be one of the following:
  • notDownloadedYet: The download has not been initiated.
  • inProgress: The download has not been initiated.
  • downloadSuccess: The download was successful.
  • downloadFailure: The download failed.
You can also check if paywalls have been downloaded with await heliumFlutter.paywallsLoaded()

Presenting Paywalls

You must have a trigger and workflow configured in the dashboard in order to show a paywall.
You can present a paywall programmatically using the presentUpsell method:
Do not call presentUpsell in Widget build() as this can have unpredictable behavior.
You can also pass in event handlers and custom paywall traits directly to presentUpsell:
Looking for alternative presentation methods? Check out the guide on Ways to Show a Paywall.
You should now be able to see Helium paywalls in your app! Well done! 🎉

Helium Events

To handle various paywall-related events, implement HeliumCallbacks and pass it to initialize:
For example:

Handling Purchases

By default, Helium will handle purchase logic for you. If you want a custom implementation, you’ll want to implement HeliumPurchaseDelegate and pass that into initialize.

Basic Implementation

Here’s a basic (incomplete) implementation of HeliumPurchaseDelegate:

RevenueCat Implementation Example

Checking Subscription Status & Entitlements

Use these methods to check current user subscription status.

Example Usage

Check entitlements before showing paywalls to avoid showing a paywall to a user who should not see it.

Fallbacks

The Flutter SDK currently has two fallback options - 1) Fallback bundle and 2) a fallback view. Fallback situations should be quite rare, but to be safe, it is highly recommended that you implement a fallback bundle or custom fallback view.