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:
iOS Setup
Add ad network adapter pods to yourios/Podfile:
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 yourios/Runner/Info.plist:
Android Setup
Add CloudX SDK and adapter dependencies to your app module — typicallyandroid/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 includeio.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’sinitState:
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
Banner Ads (320x50)
Banners use the programmatic overlay approach — they overlay your content at a fixed screen position.Banner Position
UseCloudXAdViewPosition to place the banner:
topLeft, topCenter, topRight, centerLeft, centered, centerRight, bottomLeft, bottomCenter, bottomRight
To update the position after creation:
Additional Banner APIs
Banner Events
MREC Ads (300x250)
MRECs work identically to banners but with a 300x250 size. Use the MREC methods: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 usingCloudXAdView:
AndroidView / UiKitView) to embed the native ad view inline with your Flutter widgets.
Advanced Features
Error Handling
All error callbacks receive aCloudXError 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
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 fromNSUserDefaults / 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:- Initialize the SDK with verbose logging enabled
- Find your device advertising ID in the console logs
- Add the device to your whitelist on the CloudX dashboard