Here you go, copy the last line listed below into your own pubspec.yaml file. You’re then on your way to monetizing your Flutter app. I’ve written a Flutter Package to utilize the plugin, firebase_admob, so to quickly and easily implement ads into a Flutter app.

Copy the last line into your pubspec.yaml file.

Ads by Example

In the first example listed below, it takes only three lines of code, to get a banner ad displayed in your app. All that’s required of you is the ‘AdMob id’ you got when you signed up for an Adsense account. The id listed here is a ‘test id’ offered by Google and is to be used during development. Of course, keep yours confidential, but when using yours during development, supply instead the second parameter, testing, to the init() function. Doing so, as you see in the example below, and setting it to true will bring up only ‘test ads.’

AdMob by Google

If you’ve yet to get setup for AdMob, go to this website, https://firebase.google.com/docs/admob/, after downloading this Dart file. You’ll need your ‘AdMob id.’ Again, test id’s are supplied by the plugin to be used during development since using your own id would violate ‘AdMob by Google’ policy. I mean, you can’t be clicking ads on your own app, don’t you know! That’d be cheating!