Skip to main content

Overview

Adrop Flutter SDK allows you to easily integrate various ad formats into your Flutter app.

Supported Ad Formats


Requirements

Flutter

  • Flutter SDK 3.3.0 or higher
  • Dart SDK 2.18.0 or higher

Android

  • API level 23 (Android 6.0) or higher
  • compileSdkVersion 34
  • Kotlin 2.1.0 or higher
  • Gradle 8.7 or higher
  • Using Jetpack (AndroidX)

iOS

  • iOS 13.0 or higher
  • Swift 5.0 or higher

Installation

1. Install Package

Run the following command in your project directory.

2. Android Setup

Add the backfill ad repository to android/settings.gradle.kts.
android/settings.gradle.kts
Add the backfill dependency to android/app/build.gradle.
android/app/build.gradle
Add the backfill App ID to android/app/src/main/AndroidManifest.xml.
android/app/src/main/AndroidManifest.xml
Please contact Adrop to get your App ID.

3. iOS Setup

Modify ios/Podfile. Add two source lines at the top of the file, and add the backfill SDK if you use backfill ads.
ios/Podfile
  • From 1.18.0, the iOS SDK (adrop-ads, adrop-ads-backfill) is published to the adrop-specs spec repo instead of CocoaPods trunk. Adding the lines while you’re on an earlier version is harmless. Commit the updated ios/Podfile.lock after adding them.
  • Add both lines. Once a Podfile lists any source, CocoaPods stops adding trunk on its own, so other pods such as Google Mobile Ads SDK can’t be installed.
  • If your Podfile already has source 'https://github.com/CocoaPods/Specs.git', add only the first line.
  • For add-to-app projects, add the lines to the host app’s Podfile.
Install pods.
When you upgrade from 1.17.x or earlier to 1.18.0 or later, run the following command instead of pod install. Leave out adrop-ads-backfill if you don’t use backfill ads. Commit the updated ios/Podfile.lock too.
Backfill SDK 1.18.0 and later uses Google Mobile Ads SDK 13. If you also use the google_mobile_ads plugin, you need version 8.0.0 or later. Versions 7.x and earlier use Google Mobile Ads SDK 12, so pod installation fails. If you can’t update the plugin, keep adrop_ads_flutter and the backfill SDK on 1.17.x (adrop_ads_flutter: ">=1.17.0 <1.18.0" in pubspec.yaml and pod 'adrop-ads-backfill', '~> 1.17.0' in the Podfile).

4. Info.plist Configuration

Add the following settings to ios/Runner/Info.plist for backfill ads.
  • GADApplicationIdentifier: App ID for backfill ads
  • SKAdNetworkItems: Required for ad conversion tracking on iOS 14+
Info.plist
If your Info.plist already contains a SKAdNetworkItems key, do not add a new one — merge only the array (<array>) entries. Duplicate keys cause iOS to use only the first array.
Please contact Adrop for the full SKAdNetworkItems list and App ID.

5. Add Configuration File

Android

  1. Download the adrop_service.json file from the Ad Control Console.
  2. Copy the file to the android/app/src/main/assets/ directory.

iOS

  1. Download the adrop_service.json file from the Ad Control Console.
  2. Add the file to the project root in Xcode.
  3. Make sure to add the file to all targets.

Initialization

Initialize the SDK at app startup. Typically called in main.dart.
main.dart
Call WidgetsFlutterBinding.ensureInitialized() before Adrop.initialize() so that platform channels are ready. Adrop.initialize() returns a Future<void>, but you can call it without await.

Initialization Options

Parameters Examples

Theme Settings

Set the ad UI theme.

Set User Identifier

Set a user identifier (UID) for targeted advertising.
UID is hashed with SHA-256 before transmission. Do not pass personally identifiable information such as email or phone number directly.

Test Unit IDs

Use the following test unit IDs during development and testing.
Be sure to replace with actual unit IDs before production deployment.

Error Codes

Error codes that can occur in the SDK.

Deprecated Class Migration

The following classes are deprecated and will be removed in a future version. Please migrate to the new classes.

AdropBanner → AdropBannerView

The AdropBanner widget is deprecated. Migrate to AdropBannerView.

AdropNavigatorObserver (Deprecated)

AdropNavigatorObserver is deprecated and will be removed in a future version. This class no longer provides any functionality and can be safely removed from your code.

Troubleshooting

iOS Build Errors

If you encounter Swift version compatibility issues, add the following to the post_install block in ios/Podfile.
ios/Podfile

Pod Installation Errors (Upgrading to 1.18.0)

  • None of your spec sources contain a spec satisfying the dependency or CocoaPods's specs repository is too out-of-date: Check that the two source lines are at the top of ios/Podfile. If they’re already there, run cd ios && pod update adrop-ads adrop-ads-backfill (or pod update adrop-ads if you don’t use backfill ads).
  • required a higher minimum deployment target or requires a higher minimum iOS deployment version than the plugin's reported minimum version: This isn’t a deployment target problem. If Podfile.lock still has an earlier version, run cd ios && pod update adrop-ads (add adrop-ads-backfill if you use backfill ads). If the error mentions Google-Mobile-Ads-SDK, another plugin uses Google Mobile Ads SDK 12. See the Google Mobile Ads SDK note in iOS Setup above.

Android Build Errors

If the Kotlin version doesn’t match, check the Kotlin version in android/build.gradle.
android/build.gradle

Next Steps

Banner Ads

Implement banner ads

Native Ads

Implement native ads

Interstitial Ads

Implement interstitial ads

Rewarded Ads

Implement rewarded ads

WebView Guide

Display web ads in WebView

UMP Integration

GDPR/CCPA consent management