functional_google_mobile_ads 0.2.2 copy "functional_google_mobile_ads: ^0.2.2" to clipboard
functional_google_mobile_ads: ^0.2.2 copied to clipboard

A functional Flutter plugin for Google Mobile Ads with simplified one-line usage for interstitial, rewarded, banner, and native ads.

functional_google_mobile_ads #

Functional Google Mobile Ads

Introduction #

This project is a functional version of google mobile ads,

First of all, you have to follow mobile ads sdk(quick-start). #

from here

import #

import 'package:functional_google_mobile_ads/functional_google_mobile_ads.dart';

One line functional Usage #

FunctionalInterstitialAd

  await FunctionalInterstitialAd.loadAndShow(adUnitId: 'adUnitId');

FunctionalRewardedAd

  await FunctionalRewardedAd.loadAndShow(adUnitId: 'adUnitId');

FunctionalRewardedInterstitialAd

  await FunctionalRewardedInterstitialAd.loadAndShow(adUnitId: 'adUnitId');

FunctionalBannerAd

Column(
    children: [
        FunctionalBannerAd(adUnitId: 'adUnitId', adSize: AdSize.banner),
    ] 
)

FunctionalNativeBannerAd

Column(
    children: [
        FunctionalNativeBannerAd(
            adUnitId: 'adUnitId',
            templateType: TemplateType.medium,
            height: 200,
        ),
    ] 
)

Advanced Usage #

    final ad = FunctionalRewardedAd();
    try {
      await ad.load(adUnitId: 'adUnitId');
      final item = await ad.show();
      print('rewarded item: $item');
    } catch (error) {
      print(error);
    } finally {
      ad.dispose();
    }

Native Banner Ad Customization #

FunctionalNativeBannerAd(
  adUnitId: 'your-native-ad-unit-id',
  templateType: TemplateType.small, // or TemplateType.medium
  width: 320,
  height: 150,
  nativeAdListener: NativeAdListener(
    onAdLoaded: (ad) => print('Native ad loaded'),
    onAdFailedToLoad: (ad, error) => print('Native ad failed to load: $error'),
    onAdClicked: (ad) => print('Native ad clicked'),
  ),
  nativeTemplateStyle: NativeTemplateStyle(
    templateType: TemplateType.small,
    mainBackgroundColor: Colors.white,
    cornerRadius: 8.0,
  ),
)
10
likes
150
points
369
downloads

Publisher

unverified uploader

Weekly Downloads

A functional Flutter plugin for Google Mobile Ads with simplified one-line usage for interstitial, rewarded, banner, and native ads.

Repository (GitHub)
View/report issues

Topics

#ads #google #admob #advertising #monetization

Documentation

Documentation
API reference

License

MIT (license)

Dependencies

flutter, google_mobile_ads, plugin_platform_interface

More

Packages that depend on functional_google_mobile_ads

Packages that implement functional_google_mobile_ads