Adrop
The main class for the Adrop SDK. Handles SDK initialization and global settings.Static Properties
| Property | Type | Description |
|---|---|---|
consentManager | AdropConsentManager | Consent manager for GDPR/CCPA consent management |
Static Methods
| Method | Description |
|---|---|
initialize(bool production, {List<String>? targetCountries, bool? useInAppBrowser}) | Initialize the SDK |
setUID(String uid) | Set user identifier (hashed with SHA-256) |
setTheme(AdropTheme theme) | Set ad theme |
registerWebView(int webViewIdentifier) | Register a WebView for backfill ad support |
Usage Example
AdropTheme
Enum for dark mode settings for ads.Values
| Value | Description |
|---|---|
light | Light mode |
dark | Dark mode |
auto | Auto-follow system settings (default) |
Usage Example
AdropErrorCode
Error codes that can occur when loading and displaying ads.Values
| Error Code | Code String | Description |
|---|---|---|
network | ERROR_CODE_NETWORK | Network error |
internal | ERROR_CODE_INTERNAL | Internal error |
initialize | ERROR_CODE_INITIALIZE | SDK initialization error |
invalidUnit | ERROR_CODE_INVALID_UNIT | Invalid ad unit ID |
notTargetCountry | ERROR_CODE_NOT_TARGET_COUNTRY | Not a target country |
inactive | ERROR_CODE_AD_INACTIVE | Deactivated ad |
adNoFill | ERROR_CODE_AD_NO_FILL | No available ads |
adLoadDuplicate | ERROR_CODE_AD_LOAD_DUPLICATED | Duplicate ad load request |
adLoading | ERROR_CODE_AD_LOADING | Ad loading in progress |
adEmpty | ERROR_CODE_AD_EMPTY | Ad is empty |
adShown | ERROR_CODE_AD_SHOWN | Ad already shown |
adHideForToday | ERROR_CODE_AD_HIDE_FOR_TODAY | Hide for today enabled |
accountUsageLimitExceeded | ERROR_CODE_ACCOUNT_USAGE_LIMIT_EXCEEDED | Account usage limit exceeded |
adLandscapeUnsupported | ERROR_CODE_LANDSCAPE_UNSUPPORTED | Landscape mode not supported |
backfillNoFill | ERROR_CODE_AD_BACKFILL_NO_FILL | No backfill ads available |
undefined | UNDEFINED | Undefined error |
Properties
| Property | Type | Description |
|---|---|---|
code | String | Error code string |
Factory Methods
| Method | Description |
|---|---|
AdropErrorCode.getByCode(String code) | Retrieve error code by code string |
AdropAdChoicesPosition
Enum for setting the AdChoices badge position on backfill native ads.Values
| Value | Integer | Description |
|---|---|---|
topLeft | 0 | Top-left corner |
topRight | 1 | Top-right corner (default) |
bottomLeft | 2 | Bottom-left corner |
bottomRight | 3 | Bottom-right corner |
Usage Example
AdropBannerView
Widget class for displaying banner ads.Constructor
Properties
| Property | Type | Description |
|---|---|---|
creativeSize | CreativeSize? | Creative size |
adSize | Size? | Banner view size setting |
Methods
| Method | Return Type | Description |
|---|---|---|
load() | Future<void> | Load ad |
dispose() | Future<void> | Release resources |
Usage Example
AdropBannerListener
Listener class for handling banner ad events.Constructor
Callbacks
| Callback | Parameters | Description |
|---|---|---|
onAdReceived | unitId, metadata | Ad received successfully |
onAdClicked | unitId, metadata | Ad clicked |
onAdImpression | unitId, metadata | Ad impression |
onAdFailedToReceive | unitId, errorCode | Ad failed to receive |
onAdVideoStart | unitId | Video ad started playing |
onAdVideoEnd | unitId | Video ad finished playing |
Metadata Fields
| Field | Type | Description |
|---|---|---|
creativeId | String | Creative ID |
txId | String | Transaction ID |
campaignId | String | Campaign ID |
destinationURL | String | Destination URL |
browserTarget | int? | Browser target (0: external, 1: internal) |
AdropNativeAd
Class for requesting native ads.Constructor
Properties
| Property | Type | Description |
|---|---|---|
isLoaded | bool | Whether ad is loaded |
unitId | String | Ad unit ID |
creativeId | String | Creative ID |
txId | String | Transaction ID |
campaignId | String | Campaign ID |
destinationURL | String | Destination URL |
browserTarget | BrowserTarget? | How the destination URL opens (external/internal browser) |
properties | AdropNativeProperties | Native ad properties |
creativeSize | CreativeSize | Creative size |
isBackfilled | bool | Whether it is a backfilled ad |
preferredAdChoicesPosition | AdropAdChoicesPosition | AdChoices badge position for backfill native ads (default: topRight) |
Methods
| Method | Return Type | Description |
|---|---|---|
load() | Future<void> | Load ad |
Usage Example
AdropNativeAdView
Widget for displaying native ads on screen.Constructor
Usage Example
AdropNativeListener
Listener class for handling native ad events.Constructor
Callbacks
| Callback | Parameters | Description |
|---|---|---|
onAdReceived | ad | Ad received successfully |
onAdClicked | ad | Ad clicked |
onAdImpression | ad | Ad impression |
onAdFailedToReceive | ad, errorCode | Ad failed to receive |
onAdVideoStart | ad | Video ad started playing |
onAdVideoEnd | ad | Video ad finished playing |
AdropNativeProperties
Content properties for native ads.Properties
| Property | Type | Description |
|---|---|---|
headline | String? | Ad headline |
body | String? | Ad body |
creative | String? | HTML creative content |
asset | String? | Image asset URL |
destinationURL | String? | URL to navigate on click |
callToAction | String? | CTA button text |
profile | AdropNativeProfile? | Advertiser profile info |
extra | Map<String, String> | Additional custom fields |
isBackfilled | bool | Whether it is a backfilled ad |
AdropNativeProfile
Profile information for native ads.Properties
| Property | Type | Description |
|---|---|---|
displayName | String? | Advertiser name |
displayLogo | String? | Advertiser logo image URL |
AdropInterstitialAd
Class for displaying interstitial ads.Constructor
Properties
| Property | Type | Description |
|---|---|---|
isLoaded | bool | Whether ad is loaded |
unitId | String | Ad unit ID |
creativeId | String | Creative ID |
txId | String | Transaction ID |
campaignId | String | Campaign ID |
destinationURL | String | Destination URL |
browserTarget | BrowserTarget? | How the destination URL opens (external/internal browser) |
Methods
| Method | Return Type | Description |
|---|---|---|
load() | Future<void> | Load ad |
show() | Future<void> | Show ad |
close() | Future<void> | Programmatically close the ad (Android only) |
dispose() | Future<void> | Release resources |
Usage Example
AdropInterstitialListener
Listener class for handling interstitial ad events.Constructor
Callbacks
| Callback | Description |
|---|---|
onAdReceived | Ad received successfully |
onAdClicked | Ad clicked |
onAdImpression | Ad impression |
onAdWillPresentFullScreen | Ad will present (iOS only) |
onAdDidPresentFullScreen | Ad presented |
onAdWillDismissFullScreen | Ad will dismiss (iOS only) |
onAdDidDismissFullScreen | Ad dismissed |
onAdFailedToReceive | Ad failed to receive |
onAdFailedToShowFullScreen | Ad failed to show |
onAdBackButtonPressed | Back button pressed while ad is displayed (Android only) |
AdropRewardedAd
Class for displaying rewarded ads.Constructor
Properties
| Property | Type | Description |
|---|---|---|
isLoaded | bool | Whether ad is loaded |
unitId | String | Ad unit ID |
creativeId | String | Creative ID |
txId | String | Transaction ID |
campaignId | String | Campaign ID |
destinationURL | String | Destination URL |
browserTarget | BrowserTarget? | How the destination URL opens (external/internal browser) |
serverSideVerificationOptions | ServerSideVerificationOptions? | Server-side verification options (userId, customData) |
Methods
| Method | Return Type | Description |
|---|---|---|
load() | Future<void> | Load ad |
show() | Future<void> | Show ad |
dispose() | Future<void> | Release resources |
Usage Example
ServerSideVerificationOptions
Options for server-side verification (SSV) in rewarded ads. Set before callingload() to pass custom data to your server callback.
Constructor
Properties
| Property | Type | Description |
|---|---|---|
userId | String? | User identifier for server-side verification |
customData | String? | Custom data string passed to the server callback |
Usage Example
AdropRewardedListener
Listener class for handling rewarded ad events.Constructor
Callbacks
| Callback | Description |
|---|---|
onAdReceived | Ad received successfully |
onAdClicked | Ad clicked |
onAdImpression | Ad impression |
onAdWillPresentFullScreen | Ad will present (iOS only) |
onAdDidPresentFullScreen | Ad presented |
onAdWillDismissFullScreen | Ad will dismiss (iOS only) |
onAdDidDismissFullScreen | Ad dismissed |
onAdFailedToReceive | Ad failed to receive |
onAdFailedToShowFullScreen | Ad failed to show |
onAdEarnRewardHandler | Reward earned |
AdropPopupAd
Class for displaying popup ads.Constructor
Properties
| Property | Type | Description |
|---|---|---|
isLoaded | bool | Whether ad is loaded |
unitId | String | Ad unit ID |
creativeId | String | Creative ID |
txId | String | Transaction ID |
campaignId | String | Campaign ID |
destinationURL | String | Destination URL |
browserTarget | BrowserTarget? | How the destination URL opens (external/internal browser) |
closeTextColor | Color? | Close button text color |
hideForTodayTextColor | Color? | ”Hide for today” text color |
backgroundColor | Color? | Button background color |
Methods
| Method | Return Type | Description |
|---|---|---|
load() | Future<void> | Load ad |
show() | Future<void> | Show ad |
close() | Future<void> | Close ad |
dispose() | Future<void> | Release resources |
Usage Example
AdropPopupListener
Listener class for handling popup ad events.Constructor
AdropMetrics
Class for managing user properties and events.Static Methods
| Method | Return Type | Description |
|---|---|---|
setProperty(String key, dynamic value) | Future<void> | Set user property |
sendEvent(String name, [Map<String, dynamic>? params]) | Future<void> | Send event |
logEvent(String name, [dynamic params]) | Future<void> | Log event (deprecated, use sendEvent) |
properties() | Future<Map<String, dynamic>> | Get all properties |
Usage Example
AdropConsentManager
Class for managing user consent (GDPR, CCPA, etc.). Access viaAdrop.consentManager.
Methods
| Method | Return Type | Description |
|---|---|---|
requestConsentInfoUpdate(listener) | Future<void> | Request consent info update and show consent form if required |
getConsentStatus() | Future<AdropConsentStatus> | Get the current consent status |
canRequestAds() | Future<bool> | Check if ads can be requested |
setDebugSettings(AdropConsentDebugGeography geography) | Future<void> | Set debug geography for testing |
reset() | Future<void> | Reset consent information |
Usage Example
AdropConsentResult
Result object returned by the consent info update callback.Properties
| Property | Type | Description |
|---|---|---|
status | AdropConsentStatus | Current consent status |
canRequestAds | bool | Whether ads can be requested |
canShowPersonalizedAds | bool | Whether personalized ads can be shown |
error | String? | Error message (null if no error) |
AdropConsentStatus
Enum representing the user’s consent status.Values
| Value | Description |
|---|---|
unknown | Consent status not yet determined |
required | Consent required (popup will be shown) |
notRequired | Consent not required (non-GDPR region) |
obtained | Consent already obtained |
AdropConsentDebugGeography
Enum for testing consent flows with different geographies.Values
| Value | Description |
|---|---|
disabled | Use actual device location |
eea | Test GDPR (European Economic Area) |
regulatedUSState | Test CCPA (California, etc.) |
other | Test non-regulated regions |
BrowserTarget
Enum controlling how destination URLs open when an ad is clicked.Values
| Value | Description |
|---|---|
external | Opens in the system’s default browser |
internal | Opens in an in-app browser |
Usage Example
CreativeSize
Class representing the size of a creative.Constructor
Properties
| Property | Type | Description |
|---|---|---|
width | double | Width |
height | double | Height |
AdropProperties
Enum for predefined user property keys used withAdropMetrics.setProperty.
Values
| Value | Code | Description |
|---|---|---|
age | AGE | User age |
birth | BIRTH | User birth date (yyyy, yyyyMM, yyyyMMdd format) |
gender | GDR | User gender (use AdropGender values) |
Usage Example
AdropGender
Enum for gender values used withAdropProperties.gender.
Values
| Value | Code | Description |
|---|---|---|
male | M | Male |
female | F | Female |
other | O | Other |
unknown | U | Unknown |
Deprecated Classes
The following classes are deprecated and will be removed in a future version.| Deprecated Class | Migration | Notes |
|---|---|---|
AdropBanner | Use AdropBannerView | Banner ad widget. Replaced by AdropBannerView and AdropBannerListener |
AdropNavigatorObserver | Can be removed | No longer provides functionality and will be removed in a future version |
Test Unit IDs
Unit IDs for development and testing.| Format | Test Unit ID |
|---|---|
| Banner (320x50) | PUBLIC_TEST_UNIT_ID_320_50 |
| Banner (320x100) | PUBLIC_TEST_UNIT_ID_320_100 |
| Native | PUBLIC_TEST_UNIT_ID_NATIVE |
| Interstitial | PUBLIC_TEST_UNIT_ID_INTERSTITIAL |
| Rewarded | PUBLIC_TEST_UNIT_ID_REWARDED |
| Popup (Bottom) | PUBLIC_TEST_UNIT_ID_POPUP_BOTTOM |
| Popup (Center) | PUBLIC_TEST_UNIT_ID_POPUP_CENTER |
| Splash | PUBLIC_TEST_UNIT_ID_SPLASH |
Related Documentation
Getting Started
SDK installation and setup guide
Examples
Example code and sample projects