How to Monetize your Flutter App with Google Ads

How to Monetize your Flutter App with Google Ads

Are you a Flutter app developer looking to monetize your app through Google Ads? Look no further! In this article, I will walk you through the steps to add Google Ads to your Flutter app and start earning revenue from your app.

Google Ads is a popular advertising platform that allows app developers to display ads in their apps and earn money when users interact with those ads. By integrating Google Ads into your Flutter app, you can display targeted ads to your users and earn revenue based on clicks or impressions.

Here's a step-by-step guide on how to add Google Ads to your Flutter app:

Step 1: Sign up for Google AdMob

The first step is to sign up for Google AdMob, which is the platform that allows you to manage ads for your apps. Go to the AdMob website ( and sign up with your Google account. Once you're signed in, you'll need to create an AdMob account and provide some basic information about your app.

Step 2: Create an Ad Unit

Once you've created an AdMob account, the next step is to create an ad unit. An ad unit represents the ad space in your app where ads will be displayed. To create an ad unit, click on the "Apps" tab in the AdMob dashboard and then click on the "Add App" button. Follow the prompts to add your app and create an ad unit for it.

Step 3: Install the Google Ads Flutter plugin

Next, you'll need to install the Google Ads Flutter plugin in your Flutter app. The plugin provides a set of Flutter widgets that you can use to display ads in your app. To install the plugin, add the following dependency to your app's pubspec.yaml file:

  google_mobile_ads: ^2.4.0

Then, run flutter pub get to install the plugin.

Step 4: Initialize the Google Ads SDK

Before you can start displaying ads in your app, you'll need to initialize the Google Ads SDK. To do this, you'll need to add the following code to your app's main method:

import 'package:google_mobile_ads/google_mobile_ads.dart';

void main() {
  // Initialize the Google Ads SDK

This code ensures that the Google Ads SDK is initialized before your app starts.

Step 5: Add ads to your app

Now that you've installed the Google Ads Flutter plugin and initialized the Google Ads SDK, you can start adding ads to your app. The plugin provides several widgets that you can use to display different types of ads, such as banners, interstitials, and rewarded ads.

Here's an example of how you can add a banner ad to your app:

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

class MyHomePage extends StatefulWidget {
  _MyHomePageState createState() => _MyHomePageState();

class _MyHomePageState extends State<MyHomePage> {
  BannerAd _bannerAd;

  void initState() {
    _bannerAd = BannerAd(
      adUnitId: '<your_ad_unit_id>',
      size: AdSize.banner,
      request: AdRequest(),
      listener: AdListener(
        onAdLoaded: (_) {
          setState(() {});
        onAdFailedToLoad: (_, error) {
          print('Ad failed to load: $error');

  void dispose() {

  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('My App'),
      body: Column(
        children: [
          // Your app's content here
          // ...
          // Display the banner ad at the bottom of the screen
          if (_bannerAd != null && _bannerAd.size != null)
              height: _bannerAd.size.height.toDouble(),
              width: _bannerAd.size.width.toDouble(),
              child: AdWidget(ad: _bannerAd),

In this example, we're using the BannerAd widget from the google_mobile_ads plugin to display a banner ad at the bottom of the screen. We initialize the banner ad in the initState() method, load it with an ad request and listen for events using the AdListener callback. When the ad is loaded, we update the UI using setState() to display the ad using the AdWidget widget.

Step 6: Handle ad events

As you saw in the example above, you can handle ad events, such as when an ad is loaded, or when an ad fails to load, using the AdListener callback. You can customize the behavior of your app based on these events. For example, you could show a different type of ad when a banner ad fails to load, or update the UI when a rewarded ad is successfully completed by the user.

Step 7: Test your ads

It's important to test your ads before releasing your app to the public. Google provides test ad units that you can use during development to ensure that your ads are displaying correctly. You can find these test ad units in the AdMob dashboard under the "Test Ad Units" section. Simply replace your real ad unit ID with the test ad unit ID during development, and make sure to revert it back to the real ad unit ID before releasing your app to production.

Step 8: Optimize your ads

To maximize your ad revenue, it's important to optimize your ads. You can experiment with different ad formats, ad placements, and ad targeting to find what works best for your app and audience. You can also use the AdMob dashboard to track the performance of your ads and make data-driven decisions to optimize your ad revenue.


In conclusion, adding Google Ads to your Flutter app is a great way to monetize your app and generate revenue. By following the steps outlined in this article, you can easily integrate Google Ads into your Flutter app and start earning money from your app. Remember to test your ads during development and optimize your ads to maximize your revenue. Happy monetizing!