Skip to main content
An Ad Unit defines an ad placement and format. Pass its Ad Unit Key from the dashboard to the ad API. This differs from the app’s Integration Key. Existing Ad Unit IDs (UUIDs) remain valid inputs.

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.
daro_flutter 2.0.6 uses Android SDK 2.0.9, iOS DaroAds 2.0.8, and Android Gradle plugin 2.0.5. After updating, rebuild your Android and iOS apps to apply the native dependency changes.

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.

Integration Keys per Build Variant

If your Android flavors or build types use different DARO apps, follow Use a different Integration Key per build variant to configure their keys.
The daroIntegrationKey property that configure writes to android/gradle.properties takes precedence over keys in build variant manifests. Remove this shared property when using a different key per variant. Running configure again writes the shared property again, so check it before building.

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.
In daro_flutter 2.0.6, configure applies DARO plugin 2.0.5 to your Android project and writes daro.safedkConfigurationCacheWorkaround=true to android/gradle.properties. The Android native SDK version is 2.0.9. 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.5 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.

App Mute Setting

Call DaroFlutter.setAppMuted to pass your app’s mute state to the DARO SDK. This API is available on Android and iOS. Update it whenever the user changes your app’s mute setting.
Native ads apply the mute state to video playback at load time, so set it before loading native ads.
Some video ad creatives that cannot play while muted may be excluded from requests. This can reduce the available ads or affect ad revenue. Use this setting to reflect the user’s choice when your app provides a mute option.

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.