flutter_ads_plugin 0.2.4 copy "flutter_ads_plugin: ^0.2.4" to clipboard
flutter_ads_plugin: ^0.2.4 copied to clipboard

Effortlessly integrate and manage Google Ads in your Flutter app with minimal code. Simplifies ad creation and boosts monetization potential.

Simple Google Ads for Flutter #

Leonardo_Phoenix_10_A_modern_sleek_mobile_application_screensh_2

🚀 Quickly and Easily Integrate Google Ads with Flutter! #

flutter_ads_plugin is a Flutter plugin that enables seamless deployment of Google Ads in your app with minimal effort. No complex configurations required.


✨ Key Features: #

  • 🚀 Quick Integration – Deploy ads in just a few minutes.
  • 🎯 Optimized Display – Ads automatically adjust to the best position and type.
  • 🛠️ Easily Customizable – Supports multiple ad formats:
    • Banner Ads
    • Interstitial Ads
    • Rewarded Ads
    • Native Ads

❓ Why Choose flutter_ads_plugin? #

  • ⏳ Time-Saving – Skips manual setup steps.
  • 🧩 Simplified – Clean, easy-to-understand code, perfect for beginners.

📽️ Demo #

Watch Demo


⚙️ Configuration #

For detailed setup instructions, refer to the official guides:


📦 Installation #

Add the plugin to your pubspec.yaml file:

flutter_ads_plugin: ^<latest-version>

Then run:

flutter pub get

🚀 Usage #

To use the plugin, import the flutter_ads_plugin package in your Flutter app:

import 'package:flutter_ads_plugin/flutter_ads_plugin.dart';

Initialize Mobile Ads in your main.dart file:

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  MobileAds.instance.initialize();
  runApp(const MyApp());
}

Display banner ads:

FlutterAdsBanner()

Display native ads:

FlutterAdsNative()

Display Rewarded Ads:

FlutterAdsRewarded.init();

FlutterAdsRewarded.show();

FlutterAdsRewarded.release();

Display Interstitial Ads:

FlutterAdsInterstitial.init();

FlutterAdsInterstitial.show();

FlutterAdsInterstitial.release();

📝 API Reference #

Function Description
onUserEarnedReward Callback triggered when the user earns a reward from a rewarded ad.
onError Callback triggered when an error occurs during ad loading or rendering.
onClose Callback triggered when the ad is closed by the user.
Setter Description
androidId Identifier for Android configurations.
iosId Identifier for iOS configurations.
factoryId Unique ID for the ad factory instance.
templateStyle Defines the visual style of the ad template.
templateType Type of the native ad template.
constraints Constraints for the native ad.

🧑‍💻 Example #

import 'package:flutter/material.dart';
import 'package:flutter_ads_plugin/flutter_ads_plugin.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  MobileAds.instance.initialize();
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  
  
  @override
  void initState() {
    FlutterAdsInterstitial.init();
    FlutterAdsRewarded.init();
    super.initState();
  }
  
  
  @override
  void dispose() {
    FlutterAdsInterstitial.release();
    FlutterAdsRewarded.release();
    super.dispose();
  }


  showInterstitialAd() {
    FlutterAdsInterstitial.show();
  }

  showInterstitialAd() {
    FlutterAdsInterstitial.show();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
          appBar: AppBar(
            title: const Text('Plugin example app'),
          ),
          body: Column(
            mainAxisSize: MainAxisSize.max,
            children: [
              const SizedBox(height: 24),
              const FlutterAdsBanner(
                iosId: '',
                androidId: '',
              ),
              const SizedBox(height: 24),
              const FlutterAdsNative(
                androidId: '',
                iosId: '',
                templateStyle: null,
                factoryId: null,
                templateType: null,
                constraints: null,
              ),
              ElevatedButton(
                  onPressed: showRewardedAd,
                  child: const Text('Show Rewarded Ad')),
              const SizedBox(height: 24),
              ElevatedButton(
                  onPressed: showInterstitialAd,
                  child: const Text('Show Interstitial Ad')),
            ],
          )),
    );
  }
}


🎥 YouTube Video Guide #

For a detailed guide on how to integrate and use the Ad Plugin, check out the video tutorial.


🤝 Contribute #

We welcome community contributions. Feel free to submit pull requests or report issues.


🐞 Issues and Feedback #

Please file an issue to send feedback or report a bug. Thank you!


📜 License #

MIT License.


"Buy Me A Coffee"

Made with ❤️ by minhto28

5
likes
150
points
113
downloads

Publisher

unverified uploader

Weekly Downloads

Effortlessly integrate and manage Google Ads in your Flutter app with minimal code. Simplifies ad creation and boosts monetization potential.

Repository (GitHub)

Documentation

API reference

License

BSL-1.0 (license)

Dependencies

equatable, flutter, flutter_bloc, google_mobile_ads

More

Packages that depend on flutter_ads_plugin