Skip to content

Instantly share code, notes, and snippets.

@Anirudhk07
Created July 7, 2020 10:20
Show Gist options
  • Save Anirudhk07/869aa3fe4f7b60fee62dcc3cd341c3ab to your computer and use it in GitHub Desktop.
Save Anirudhk07/869aa3fe4f7b60fee62dcc3cd341c3ab to your computer and use it in GitHub Desktop.
import 'dart:io';
class AdManager {
static String get appId {
if (Platform.isAndroid) {
return "<YOUR_ANDROID_ADMOB_APP_ID>";
} else if (Platform.isIOS) {
return "<YOUR_IOS_ADMOB_APP_ID>";
} else {
throw new UnsupportedError("Unsupported platform");
}
}
static String get bannerAdUnitId {
if (Platform.isAndroid) {
return "<YOUR_ANDROID_BANNER_AD_UNIT_ID";
} else if (Platform.isIOS) {
return "<YOUR_IOS_BANNER_AD_UNIT_ID>";
} else {
throw new UnsupportedError("Unsupported platform");
}
}
static String get interstitialAdUnitId {
if (Platform.isAndroid) {
return "<YOUR_ANDROID_INTERSTITIAL_AD_UNIT_ID>";
} else if (Platform.isIOS) {
return "<YOUR_IOS_INTERSTITIAL_AD_UNIT_ID>";
} else {
throw new UnsupportedError("Unsupported platform");
}
}
static String get rewardedAdUnitId {
if (Platform.isAndroid) {
return "<YOUR_ANDROID_REWARDED_AD_UNIT_ID>";
} else if (Platform.isIOS) {
return "<YOUR_IOS_REWARDED_AD_UNIT_ID>";
} else {
throw new UnsupportedError("Unsupported platform");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment