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
compileSdkVersion34- 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 toandroid/settings.gradle.kts.
android/settings.gradle.kts
android/app/build.gradle.
android/app/build.gradle
android/app/src/main/AndroidManifest.xml.
android/app/src/main/AndroidManifest.xml
Please contact Adrop to get your App ID.
3. iOS Setup
Modifyios/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 updatedios/Podfile.lockafter 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.
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 toios/Runner/Info.plist for backfill ads.
- GADApplicationIdentifier: App ID for backfill ads
- SKAdNetworkItems: Required for ad conversion tracking on iOS 14+
View Info.plist Configuration
View Info.plist Configuration
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
- Download the adrop_service.json file from the Ad Control Console.
- Copy the file to the
android/app/src/main/assets/directory.
iOS
- Download the adrop_service.json file from the Ad Control Console.
- Add the file to the project root in Xcode.
- Make sure to add the file to all targets.
Initialization
Initialize the SDK at app startup. Typically called inmain.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
Examples
Theme Settings
Set the ad UI theme.Set User Identifier
Set a user identifier (UID) for targeted advertising.Test Unit IDs
Use the following test unit IDs during development and testing.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
TheAdropBanner 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 thepost_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 dependencyorCocoaPods's specs repository is too out-of-date: Check that the twosourcelines are at the top ofios/Podfile. If they’re already there, runcd ios && pod update adrop-ads adrop-ads-backfill(orpod update adrop-adsif you don’t use backfill ads).required a higher minimum deployment targetorrequires a higher minimum iOS deployment version than the plugin's reported minimum version: This isn’t a deployment target problem. IfPodfile.lockstill has an earlier version, runcd ios && pod update adrop-ads(addadrop-ads-backfillif you use backfill ads). If the error mentionsGoogle-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 inandroid/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