Skip to main content

Overview

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

Supported Ad Formats

FormatDescription
Banner AdRectangular ads displayed in a portion of the screen
Native AdAds that naturally blend with your app content
Interstitial AdFull-screen ads
Rewarded AdFull-screen ads that provide rewards
Popup AdAds displayed in popup format

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 7.6.3 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.
flutter pub add adrop_ads_flutter

2. iOS Setup

Modify ios/Podfile.
ios/Podfile
use_frameworks!
Install pods.
cd ios && pod install --repo-update && cd ..

3. 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.
android/app/src/main/assets/adrop_service.json

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
import 'package:adrop_ads_flutter/adrop_ads_flutter.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
    _initializeAdrop();
  }

  Future<void> _initializeAdrop() async {
    // false: test mode, true: production mode
    await Adrop.initialize(false);
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: HomeScreen(),
    );
  }
}

Initialization Options

await Adrop.initialize(
  production,        // bool: production mode flag
  targetCountries: targetCountries,   // List<String>?: target country codes (optional)
  useInAppBrowser: useInAppBrowser    // bool?: iOS in-app browser usage (optional)
);
Parameters
ParameterTypeRequiredDescription
productionboolYtrue: production mode, false: test mode
targetCountriesList<String>NCountry codes to show ads (e.g., ['KR', 'US'])
useInAppBrowserboolNiOS in-app browser usage (default: false)
Examples
// Basic initialization (test mode)
await Adrop.initialize(false);

// Production mode + specific country targeting
await Adrop.initialize(true, targetCountries: ['KR', 'JP', 'US']);

// Production mode + iOS in-app browser
await Adrop.initialize(true, useInAppBrowser: true);

Theme Settings

Set the ad UI theme.
import 'package:adrop_ads_flutter/adrop_ads_flutter.dart';

// Set theme
await Adrop.setTheme(AdropTheme.auto);  // Follow system settings
await Adrop.setTheme(AdropTheme.light); // Light mode
await Adrop.setTheme(AdropTheme.dark);  // Dark mode
ThemeDescription
AdropTheme.autoAutomatically switches based on system settings
AdropTheme.lightLight mode
AdropTheme.darkDark mode

Set User Identifier

Set a user identifier (UID) for targeted advertising.
import 'package:adrop_ads_flutter/adrop_ads_flutter.dart';

// After user login
await Adrop.setUID('user_123');

// On logout
await Adrop.setUID('');
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.
FormatTest Unit ID
Banner (320x50)PUBLIC_TEST_UNIT_ID_320_50
Banner (320x100)PUBLIC_TEST_UNIT_ID_320_100
NativePUBLIC_TEST_UNIT_ID_NATIVE
InterstitialPUBLIC_TEST_UNIT_ID_INTERSTITIAL
RewardedPUBLIC_TEST_UNIT_ID_REWARDED
Popup (Bottom)PUBLIC_TEST_UNIT_ID_POPUP_BOTTOM
Popup (Center)PUBLIC_TEST_UNIT_ID_POPUP_CENTER
SplashPUBLIC_TEST_UNIT_ID_SPLASH
Be sure to replace with actual unit IDs before production deployment.

Error Codes

Error codes that can occur in the SDK.
Error CodeDescription
networkNetwork error
internalInternal error
initializeSDK initialization error
invalidUnitInvalid unit ID
notTargetCountryNot a target country
inactiveInactive ad
adNoFillNo ads to display
adLoadDuplicateDuplicate load request
adLoadingLoading in progress
adEmptyEmpty ad
adShownAd already shown
adHideForTodayHidden for today
adLandscapeUnsupportedLandscape mode not supported
backfillNoFillNo backfill ads
import 'package:adrop_ads_flutter/adrop_ads_flutter.dart';

// Error handling example
if (errorCode == AdropErrorCode.adNoFill) {
  debugPrint('No ads available to display.');
}

Troubleshooting

iOS Build Errors

If you encounter Swift version compatibility issues, add the following to the post_install block in ios/Podfile.
ios/Podfile
post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
    end
  end
end

Android Build Errors

If the Kotlin version doesn’t match, check the Kotlin version in android/build.gradle.
android/build.gradle
buildscript {
    ext.kotlin_version = '2.1.0'
}

Next Steps