VelocityAds
initialize()
appKey- Your application key for the current platform (required). iOS and Android use different keys.debug- Enable debug logging (default:false)
{"success": true} on success
Throws: VelocityAdsError on initialization failure, with code (numeric error code) and message (human-readable description)
setUserId()
initialize() if the user ID is known at startup. Pass null to clear the user ID.
Parameters:
userId- User identifier string, ornullto clear
isInitialized()
true if the SDK is initialized, false otherwise
setDoNotSell()
flag-trueto opt out of data sale,falseto allow
setConsent()
flag-trueif user consents,falseif user denies
VelocityNativeAdRequest
Immutable ad request containing targeting parameters.prompt- User’s query or prompt for contextual targetingaiResponse- AI-generated response content for better targetingconversationHistory- Previous conversation turns asConversationMessagelistadditionalContext- Extra context information (e.g., page content, user preferences)adUnitId- Optional ad unit identifier for reporting
VelocityNativeAdViewRequest
ExtendsVelocityNativeAdRequest to request an SDK-rendered native ad view.
size- Required. The ad view size (VelocityAdViewSize.s,.m, or.l)adConfiguration- Optional theming configuration for the ad view- All parameters from
VelocityNativeAdRequestare also available
VelocityNativeAd
Instance-based ad object. Create with a request, callload(), then access ad data via data or the rendered widget.
load()- Loads the ad asynchronously. Populatesdataon success. ForVelocityNativeAdViewRequest, also creates a rendered widget accessible viawidget. ThrowsVelocityAdsErroron failure.destroy()- Releases native resources. Always call when the ad is no longer needed.
data-NativeAdData?containing all ad creative fields after a successfulload()widget- FlutterWidgetembedding the native ad view. Only available afterload()when the request is aVelocityNativeAdViewRequestlistener- OptionalVelocityNativeAdListenerfor data-only ad events. Set before callingload()viewListener- OptionalVelocityNativeAdViewListenerfor SDK-rendered view events. Set before callingload()
NativeAdData
Immutable object containing the ad creative fields. Available viaVelocityNativeAd.data after a successful load.
| Field | Type | Description |
|---|---|---|
id | String | Internal SDK record identifier |
adId | String | Ad identifier used for impression/click tracking |
title | String | Ad headline |
description | String | Ad body text |
callToAction | String | CTA button text (e.g., “Learn More”) |
advertiserName | String | Advertiser / brand display name |
sponsoredLabel | String | ”Sponsored” label text |
badgeLabel | String | Short badge label (e.g., “ad”) |
advertiserIconUrl | String | Brand icon URL (small square thumbnail) |
largeImageUrl | String? | Landscape hero image URL. null if not available |
squareImageUrl | String? | Square (1:1) image URL. null if not available |
clickUrl | String | Destination URL when the ad is clicked |
impressionUrl | String | URL to track ad impressions |
VelocityNativeAdListener
Abstract class for data-only ad lifecycle events. Use withVelocityNativeAdRequest.
VelocityNativeAdViewListener
Abstract class for SDK-rendered view ad lifecycle events. Use withVelocityNativeAdViewRequest.
onAdLoaded callback receives both the VelocityNativeAd instance and the platform-rendered Widget (adView), identical to ad.widget.
VelocityAdViewSize
| Value | Height | Use Case |
|---|---|---|
VelocityAdViewSize.s | 50dp | Compact banner-style ads |
VelocityAdViewSize.m | 100dp | Standard inline ads |
VelocityAdViewSize.l | 300dp | Rich media ads with images |
AdConfiguration
colorScheme- Custom color palette for light and dark modesadTypography- Custom text styles for ad elementsdarkTheme-nullto follow system,true/falseto force a specific mode
AdColorScheme
AdColors
Color tokens for ad rendering. UseAdColors.lightDefaults() or AdColors.darkDefaults() for built-in palettes, then copyWith() to override specific tokens.
| Token | Description |
|---|---|
cardBackground | Background color of the ad card |
sponsoredLabelText | ”Sponsored” label text color |
titleText | Ad title text color |
descriptionText | Ad description text color |
brandText | Advertiser/brand name text color |
sponsoredBadgeBackground | Sponsored badge background |
sponsoredBadgeText | Sponsored badge text color |
ctaBackground | Call-to-action button background |
ctaText | Call-to-action button text color |
chevronIconTint | Chevron/arrow icon tint |
brandIconBorder | Brand icon border color |
AdTypography
Typography tokens for ad text elements.| Token | Description |
|---|---|
brandName | Advertiser/brand name text style |
sponsoredLabel | ”Sponsored” label text style |
sponsoredBadgeText | Sponsored badge text style |
title | Ad title text style |
description | Ad description text style |
ctaButton | CTA button text style |
AdTextStyle
AdFontWeight
Font weight constants for use withAdTextStyle.
| Constant | Weight |
|---|---|
AdFontWeight.normal | 400 |
AdFontWeight.medium | 500 |
AdFontWeight.semiBold | 600 |
AdFontWeight.bold | 700 |
ConversationMessage
role-"user"or"assistant"content- Message text

