Skip to content

About

[08/16 · Flutter Studio] 💰 Drop-in AdMob monetization kit for Flutter — auto debug test IDs, interstitial capping, adaptive banners, EN/বাংলা rewarded prompts & app_pulse_kit kill-switch.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

smart_ad_kit

Drop-in AdMob monetization kit for Flutter built for indie Play Store apps:

  • Zero accidental live ad clicks in debug/profile builds — automatically swaps in official Google test unit IDs unless running a release build (protects your AdMob account).
  • Anti-spam interstitial protection — new-user grace period (default 10 min), action counter (default every 3rd action), cooldown timer (default 90s), and per-session cap (default 6).
  • 1-line remote kill-switch for app_pulse_kit — turn ads OFF globally across all users anytime without an app update (controller.syncWithRemoteFlag(...)), plus persistent Pro / VIP setAdFree(true).
  • Drop-in SmartBannerAd — anchored adaptive banner that smoothly collapses and disposes itself when ads are disabled, ad-free, or fail to load.
  • Friendly EN / বাংলা Rewarded Unlock Dialog — showRewardedWithPrompt(...) with automatic instant grant for VIP / kill-switched users so features never break.
  • Non-blocking UMP GDPR consent + safe desktop/web/test platform guards + FakeAdBackend for deterministic tests.

Install

dependencies:
  smart_ad_kit:
    git:
      url: https://github.com/Keshab1997/smart_ad_kit.git
      ref: main

Quick Start

1. Android AndroidManifest.xml

Add your AdMob App ID inside <application> in android/app/src/main/AndroidManifest.xml:

<meta-data
    android:name="com.google.android.gms.ads.APPLICATION_ID"
    android:value="ca-app-pub-3940256099942544~3347511713" />

(Replace the sample App ID above with your real AdMob App ID before Play Store release, and make sure your developer website hosts app-ads.txt.)

2. Initialize once at startup + connect app_pulse_kit

import 'package:smart_ad_kit/smart_ad_kit.dart';

final adController = SmartAdController(
  config: const SmartAdConfig(
    unitIds: AdUnitIds(
      androidBanner: 'ca-app-pub-XXXX/banner',
      androidInterstitial: 'ca-app-pub-XXXX/interstitial',
      androidRewarded: 'ca-app-pub-XXXX/rewarded',
    ),
    newUserGracePeriod: Duration(minutes: 10),
    actionsBetweenInterstitials: 3,
    minInterstitialInterval: Duration(seconds: 90),
    maxInterstitialsPerSession: 6,
  ),
);

await adController.init();

// Optional: 1-line remote kill-switch from app_pulse_kit!
// adController.syncWithRemoteFlag(
//   pulse.flags.isEnabled('ads_enabled', defaultValue: true),
// );

3. Drop in an adaptive Banner

Scaffold(
  body: MyScreenBody(),
  bottomNavigationBar: SmartBannerAd(controller: adController),
)

4. Trigger safe Interstitials on natural transitions

await adController.recordActionAndMaybeShowInterstitial();

5. Trigger Rewarded Unlocks (English or বাংলা)

final result = await adController.showRewardedWithPrompt(
  context,
  strings: isBangla ? const AdStrings.bn() : const AdStrings.en(),
);
if (result.granted) {
  unlockFeature();
}

6. Inspect live state in your hidden Debug Sheet

AdDiagnosticsSheet.show(
  context,
  controller: adController,
  strings: isBangla ? const AdStrings.bn() : const AdStrings.en(),
);

Testing

Use FakeAdBackend in your app's widget tests so tests stay 100% deterministic with zero native platform channel crashes:

final adController = SmartAdController(backend: FakeAdBackend());
await adController.init();

Run checks locally:

python3 tool/preflight.py
flutter analyze --fatal-infos
flutter test

About

[08/16 · Flutter Studio] 💰 Drop-in AdMob monetization kit for Flutter — auto debug test IDs, interstitial capping, adaptive banners, EN/বাংলা rewarded prompts & app_pulse_kit kill-switch.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages