Skip to main content
pub package The CloudX Flutter SDK enables monetization of your Flutter apps with banner, MREC, interstitial, and rewarded ads on iOS and Android.
Prefer AI-assisted setup? Point your coding agent at the CloudX agent package — see AI-assisted integration.

Installation

Requirements

These match the published package constraints on pub.dev: The Dart range is intentionally wide so apps on older Flutter LTS lines can add cloudx_flutter without upgrading the whole toolchain. Add the SDK to your pubspec.yaml:
Then run:

iOS Setup

Add ad network adapter pods to your ios/Podfile:
Then install pods:
The CloudXCore pod is automatically included as a dependency of the cloudx_flutter package. You only need to add the adapter pods you want.

App Transport Security

If your ads use HTTP URLs, add the following to your ios/Runner/Info.plist:

Android Setup

Add CloudX SDK and adapter dependencies to your app module — typically android/app/build.gradle or android/app/build.gradle.kts:
At least one adapter is required for the SDK to serve ads. Remove adapter lines you do not use.

Mintegral adapter and Maven repository

If you include io.cloudx:adapter-mintegral, Gradle must resolve Mintegral’s SDK from Mintegral’s own Maven server (not Maven Central). Add their repository in your Android Gradle repositories configuration (usually the project-level build.gradle / build.gradle.kts, e.g. inside allprojects { repositories { … } } in Flutter apps). Full steps, Kotlin/Groovy snippets, and troubleshooting are in the Android integration guide — Mintegral Maven repository.

Initialization

Initialize the SDK before loading any ads. Typically in your main widget’s initState:
CloudX.initialize() returns a non-null CloudXConfiguration on success, or null on failure. The configuration object has no properties today—use the return value only as a success signal. Other initialization utilities:

Ad Integration

Banners use the programmatic overlay approach — they overlay your content at a fixed screen position.
Auto-refresh is enabled by default. To control it manually:
Use CloudXAdViewPosition to place the banner: topLeft, topCenter, topRight, centerLeft, centered, centerRight, bottomLeft, bottomCenter, bottomRight To update the position after creation:

Additional Banner APIs

MREC Ads (300x250)

MRECs work identically to banners but with a 300x250 size. Use the MREC methods:
The MREC API is identical to the Banner API — all the same methods and events are available, including updateMRECPosition, setMRECPlacement, setMRECCustomData, auto-refresh control, and all event listeners.

Interstitial Ads

Full-screen ads shown at natural transition points.

Interstitial Events

Rewarded Ads

Full-screen ads that grant users a reward upon completion.

Rewarded Events

The CloudXReward object contains:
  • label — the label of the reward (e.g., “coins”)
  • amount — the reward quantity

Widget-Based Ad Views

In addition to the programmatic overlay approach, you can embed banner and MREC ads directly in your widget tree using CloudXAdView:
This uses Flutter’s platform view system (AndroidView / UiKitView) to embed the native ad view inline with your Flutter widgets.

Advanced Features

Error Handling

All error callbacks receive a CloudXError with code and message properties: See CloudXErrorCode for the full list of error codes.

Revenue Tracking

All ad formats provide revenue callbacks. CloudXAd includes adUnitId, adFormat, networkName, revenue (USD), optional placement, and optional networkPlacement:

User Targeting

The hashed user ID is a publisher-provided pseudonymous identifier. When applicable privacy signals allow it, CloudX captures the value at auction time and returns it as hashed_user_id in the impression-level revenue export. Use it to join CloudX revenue to cohorts in your own user data. The export value is empty when no ID was set, persistence was suppressed by privacy signals, or the value exceeded 128 characters. Do not pass raw personal data.

Privacy Compliance

Reads IAB GPP, TCF v2, and US Privacy strings from NSUserDefaults / SharedPreferences (typically set by a CMP). Manual APIs: CloudX.setHasUserConsent(bool?) and CloudX.setDoNotSell(bool?) when you do not use a CMP, or to override until cleared. null removes the override; resolution order matches the native SDK (stored IAB strings and these overrides). Callable before CloudX.initialize().

Test Mode

Test mode is server-controlled via device whitelisting:
  1. Initialize the SDK with verbose logging enabled
  2. Find your device advertising ID in the console logs
  3. Add the device to your whitelist on the CloudX dashboard

Debug Logging

Visual Debugging

Enable visual debugging overlays to see ad unit boundaries and network info (iOS only):

Support

For support, contact support@cloudx.io