pub package pub package pub package

Many flutter project earning with Google Admob and using firebase for analytics, This package help you can config AdMob ads with Firebase Remote Config and A/B testing on them


  1. On/Off Ads
  2. Config Ads Unit Id
  3. A/B testing ads position
  4. Setup width/height of Ads for banner ads
  5. ... continue

Getting started

This package depends on:

  1. google_mobile_ads
  2. firebase_remote_config

If you don't have, please follow below tutorials to setup them


Setup firebase remote config with a key you want to using like this:

  1. Your config key: banner_ad
  2. Your config data:
  "enable": true,
  "ad_unit_id_android": "ca-app-pub-3940256099942544/6300978111",
  "ad_unit_id_ios": "ca-app-pub-3940256099942544/2934735716",
  "position": null,
  "distance": null,
  "width": null,
  "height": null
  1. Your config key: interstitial_ad
  2. Your config data:
  "enable": true,
  "ad_unit_id_android": "ca-app-pub-3940256099942544/1033173712",
  "ad_unit_id_ios": "ca-app-pub-3940256099942544/4411468910",
  "request_time_to_show": 10,
  "fail_time_to_stop": 3,
  "init_request_time": 0

like this

example config

Add your Ads widget to anywhere with a key you want integrate with:

// Interstitial Ads from Firebase Remote Config
final interstitialAd = AppInterstitialAd.fromKey(
  keyConfig: 'interstitial_ad',

// Banner Ads from Firebase Remote Config
Widget bannerAds() {
  return AppBannerAd.fromKey(configKey: 'banner_ad');

// InterstitialAd show button
Widget interstitialAd() {
  return TextButton(
    onPressed: () =>,
    child: const Text('InterstitialAd'),

example ads

Setup Google Admob

Config your google admob like this tutorial

Google Admob

  1. In your project-level build.gradle file, include Google's Maven repository and Maven central repository in both your buildscript and allprojects sections:
buildscript {
    repositories {

allprojects {
    repositories {
  1. Add the dependencies for the Google Mobile Ads SDK to your module's app-level Gradle file, normally app/build.gradle:
dependencies {
    implementation ''
  1. Add your AdMob app ID (identified in the AdMob UI) to your app's AndroidManifest.xml file. To do so, add a

        <!-- Sample AdMob app ID: ca-app-pub-3940256099942544~3347511713 -->
        <meta-data android:name=""
            android:value="ca-app-pub-xxxxxxxxxxxxxxxx~yyyyyyyyyy" />

In a real app, use your actual AdMob app ID, not the one listed above. If you're just looking to experiment with the SDK in a Hello World app, you can use the sample app ID shown above.

Note also that failure to add the

Setup Firebase remote config

Setup firebase remote config like this tutorials:

Flutter Config

Native Config

Additional information

Tell me if you want a support

Give me a coffee