Flutter ScaleMonk Ads

Pub Version ISC License

A Flutter plugin to display ads from ScaleMonk. It currently supports Banner, Interstitial and Reward ads.

โš™๏ธ Installation

ScaleMonk Docs

  1. Add the dependency to the pubspec.yaml file in your project:
  scale_monk: any
  1. Install the plugin by running the command below in the terminal, in your project's root directory:
$ flutter pub get


Change android/app/build.gradle:

android {
    compileSdkVersion 29
    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 29
buildTypes {
        release {
            minifyEnabled false
            shrinkResources false
        <meta-data android:name="com.scalemonk.libs.ads.applicationId" 
                   android:value="[YOUR SM APP ID HERE]" />
        <meta-data android:name="applovin.sdk.key" 
              android:value="[YOUR APPLOVIN SDK KEY]"/>



        android:label="App Name" 




Admob 7.42.0 requires the App ID to be included in Info.plist. Failure to do so will result in a crash on launch of your app.
The lines should look like:


On your Podfile:

Ensure that the iOS version specified on the Podfile is at least 10.0:

platform :ios, '10.0'

add these lines:

source 'https://github.com/scalemonk/ios-podspecs-framework'
source 'https://github.com/CocoaPods/Specs.git'

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      # config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "i386, arm64" # to support simulator
      if ['RxSwift', 'Willow'].include? target.name
        config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'

๐Ÿ“ฑ Usage


You can initialize ScaleMonk with the function:

// Initialize ScaleMonk
await ScaleMonk.initialize(
    iosApplicationId: '<your-scaleMonk-ios-id>',
// At this point you are ready to display ads

๐Ÿ‘ฎ๐Ÿพโ€โ™‚๏ธ Consent to track the user

Before you initialize the plugin and start displaying ads, you might need to collect the user's consent to be tracked online, depending on his location or the operating system that he is using.

For iOS 14+ only

Follow the iOS 14+ Support Guide

Since iOS 14+ you are required to request a specific permission before you can have access to Apple's IDFA (a sort of proprietary cookie used by Apple to track users among multiple advertisers. To request this permission call the function ScaleMonk.requestTrackingAuthorization():

// iOS 14+: request permission to track users
// on iOS <= 13 and Android this function does nothing; it just returns true
await ScaleMonk.requestTrackingAuthorization();

For iOS versions before 14 and for Android devices this function won't do anything, so it's safe to call it on any device OS or version.


To comply with General Data Protection Regulation (GDPR) you'll have to provide the consent status of your users. If consent is given, the partners' mediation providers will be able to send targeted ads.

By sending true the user accepts to share information to receive targeted ads. By sending false the user doesn't give consent to receive targeted ads.

ScaleMonk.setHasGDPRConsent(status: Bool)

If the user is under the age of consent call this method with YES, otherwise you can call this method using false.
If you don't call this method we assume the user is not under the age of consent and you have to send whether the user accepted or not the consent

ScaleMonk.setUserCantGiveGDPRConsent(status: Bool)

COPPA: Child Directed Treatment

This method allows you to specify whether you would like your app to be treated as child-directed for purposes of the Childrenโ€™s Online Privacy Protection Act (COPPA)


๐Ÿ’ต Showing ads

After you collect all the permissions and the plugin properly initialized, you are ready to display the ads:

Interstitial & Reward ads

To show interstitial or reward ad, call the function ScaleMonk.show() passing the type of ad that you would like to show as a paremeter (mandatory) and the Tag (optional)

ScaleMonk.show(AdType.interstitial, tag: "optional-tag");
ScaleMonk.show(AdType.reward, tag: "optional-tag");


To display a banner ad in your app, just include the SMBanner() widget somewhere in your widget tree. For example:

  child: SMBanner()

Close Banner


Checking if the rewarded video is ready to be shown

You'll likely want to check availability before offering the user the possibility of seeing an ad to get a reward using this method:
Note that the rewarded video caching doesn't depend on a specific tag so this parameter is optional.

ScaleMonk.isRewardedReadyToShow(tag: "optional-tag");

โ™ป๏ธ Callbacks

You can define callbacks to your ads and track when an event occurs; it can be done by calling the callback below:

ScaleMonk.setBannerCallback = (BannerAdEvent event) {};
ScaleMonk.setInterstitialCallback = (InterstitialAdEvent event) {};
ScaleMonk.setRewardCallback = (RewardedVideoAdEvent event) {};

And if later I don't want to track reward events anymore, I just need to pass the value null to the same callback:

 ScaleMonk.setRewardCallback = null;

๐Ÿ“ License

scalemonk is released under the ISC License. See LICENSE for details.

๐Ÿ‘จ๐Ÿพโ€๐Ÿ’ป Author

Giovani Lobato (GitHub)