Skip to main content
An Ad Unit defines an ad placement and format in your app. For the DARO 2.0 SDK, copy the Ad Unit Key from the updated dashboard. This is different from the app’s Integration Key. API parameters such as adUnitId, unitId, and key, and example placeholders such as YOUR_AD_UNIT_ID, keep their names but take that Ad Unit’s Ad Unit Key. Existing integrations using Ad Unit IDs remain supported. Do not confuse reporting or callback identifiers with the key for a new integration.

Before You Begin

If you use an earlier SDK, start with the migration guide.
Load all ads after DaroFlutter.initialize() completes. Display banner and native ad widgets only after initialization as well.

Requirements

  • Flutter 3.24.0 or later, Dart 3.5.0 or later
  • Android minSdkVersion 23, Kotlin 2.2 or later
  • iOS 13.0 or later. If your Flutter version requires a higher deployment target, follow that requirement.

Installing the Package

Specify the package version in pubspec.yaml.

Automatic Native Configuration

Use the configure and doctor commands in daro_flutter to apply and check native configuration. After installing the package, create daro.yaml beside your app’s pubspec.yaml. Use the Integration Key for each platform’s app and omit platforms you do not build.
Specify integration_key for each platform. If Android builds encounter a SafeDK error, follow Resolving SafeDK Build Errors below. Run these commands from your app root.
  • configure applies the required Android and iOS settings. Run it again after updating the SDK or changing an Integration Key.
  • doctor checks your configuration. Follow its instructions to resolve any issues.
  • Automatic setup supports standard Flutter projects. If your customized project structure is unsupported, follow the manual steps below.
  • Remove conflicts with existing manual DARO settings, and do not add settings already applied automatically.
  • Configure app-specific permissions, including the iOS tracking permission description, then continue to Initializing the SDK.
  • Build and run your app to verify SDK initialization and ad behavior.

Resolving SafeDK Build Errors

If an Android Release build reports a Configuration Cache error in a safedk* or process…Manifest task, update to daro_flutter 2.0.1 or later and add this option to the Android section of daro.yaml.
After updating the package, apply the settings again from your app root and build the app.
configure applies DARO plugin 2.0.3 to your Android project and writes daro.safedkConfigurationCacheWorkaround=true to android/gradle.properties. The Android native SDK version is 2.0.2. Set the option to false to disable the workaround. Omitting it preserves the existing Gradle value, so disabling a previously enabled workaround requires setting false and running configure again. If neither the option nor an existing Gradle value is present, the workaround is inactive. Write true and false without quotes. For manually configured Android projects, follow the SafeDK troubleshooting steps in Android Getting Started to apply plugin 2.0.3 and the Gradle property directly.

Configuring the Android Project

Follow Android Getting Started to configure repositories, the DARO Gradle plugin, and the Integration Key. Use the native SDK dependency provided by daro_flutter.
  • Apply the project settings under android/.
  • Apply the so.daro plugin to the app module.
  • Add your app’s Integration Key inside <application> in android/app/src/main/AndroidManifest.xml.
If minSdkVersion is below 26, also apply the desugaring settings in Android Getting Started.

Configuring the iOS Project

Follow iOS Getting Started to install the build tools and configure the Integration Key, SKAdNetworkItems, and the tracking permission message in ios/Runner/Info.plist.
daro_flutter provides the DaroAds dependency, so do not add the same SDK again to the Podfile. Add the following hook to the existing post_install block and keep the Flutter build settings.
Use only one post_install block. Merge the hook into the existing block and keep any app-specific settings. Both the Integration Key and hook must be configured.
After running flutter pub get, run this command from ios/.

Initializing the SDK

Complete your app’s consent flow, then pass the user’s choice and your app’s applicability decision to the function below. Use DaroGdprStatus, DaroCcpaStatus, and DaroCoppaStatus without assuming opt-in. Await these settings, including COPPA, before initialization. Include the corresponding consent string when updating a status. MyApp is your app’s root widget. In your app entrypoint, call WidgetsFlutterBinding.ensureInitialized() before using consent plugins, then call startAppWithPrivacy when the results are ready.

Verifying Ad Display

Complete the app-ads.txt setup, then verify loading, display, dismissal, and callbacks for every ad format you use on a physical device.