A lightweight Flutter plugin to integrate TopOn Ads using method channels.
This plugin provides simple methods to initialize the SDK and display Interstitial, Rewarded, Native, Banner, and Splash ads in your Flutter apps.
π GitHub: https://github.com/jaiswal4sudeep/ToponAdPlugin
- β Initialize TopOn SDK
- β Load & Show Interstitial Ads
- β Load & Show Rewarded Ads
- β Load Native Ads and render custom Flutter widgets
- β Load Banner Ads
- β Load Splash Ads
- β Listen to Ad Events from Native Side
Add this plugin to your pubspec.yaml:
dependencies:
topon_ad_plugin:
git:
url: https://github.com/jaiswal4sudeep/ToponAdPlugin.git-
Add TopOn SDK dependencies:
Follow the official TopOn Android integration guide. -
Update your
AndroidManifest.xml:- Add necessary permissions
- Include required meta-data tags from TopOn
-
Add Proguard Rules (if using Proguard)
Call this once during app startup to listen to ad lifecycle events from native code.
ToponAdPlugin.setUpListeners((event, args) {
print('Ad Event: \$event, Data: \$args');
});final success = await ToponAdPlugin.initializeSdk(
appId: 'your_app_id',
appKey: 'your_app_key',
);await ToponAdPlugin.loadInterstitialAd(placementId: 'your_interstitial_id');
final shown = await ToponAdPlugin.showInterstitialAd();await ToponAdPlugin.loadRewardedAd(placementId: 'your_rewarded_id');
final shown = await ToponAdPlugin.showRewardedAd();await ToponAdPlugin.loadNativeAd(placementId: 'your_native_id');
final nativeAdInfo = await ToponAdPlugin.getNativeAdInfo();
if (nativeAdInfo != null) {
print(nativeAdInfo.title);
// Render your custom native ad widget
}await ToponAdPlugin.loadBannerAd(
placementId: 'your_banner_id',
position: BannerPosition.bottom,
);β‘ Note: Banner ads auto-render at top or bottom based on the provided position.
await ToponAdPlugin.loadSplashAd(placementId: 'your_splash_id');- Use real
appId,appKey, andplacementIdfrom the TopOn dashboard. - Always test ad behavior on a real device (not emulator).
MIT License. Free to use, modify, and distribute.