adivery_ads 0.0.2
adivery_ads: ^0.0.2 copied to clipboard
Flutter plugin for Adivery Ads by Moein kasaei
Adivery Ads Flutter Plugin #
me #
moein kasa .@@=> [email protected] https://mfuzzy.com
start #
Adivery Ads is a Flutter plugin that allows you to integrate Adivery ad services into your Flutter application seamlessly.
Features #
- Supports banner ads, interstitial ads, and rewarded ads.
- Easy integration with customizable ad placement.
- Lightweight and efficient.
Installation #
Add the following to your pubspec.yaml:
dependencies:
adivery_ads: ^0.0.2
https://docs.adivery.com/flutter
Adivery Ads Flutter Plugin
Adivery Ads is a Flutter plugin that allows you to integrate Adivery ad services into your Flutter application seamlessly.
Author
Moein Kasai Email: [email protected]
Features • Supports banner ads, interstitial ads, and rewarded ads. • Easy integration with customizable ad placement. • Lightweight and efficient.
Installation
To include this plugin in your project, add the following line to your pubspec.yaml file:
dependencies: adivery_ads: ^0.0.2
Then, update your project dependencies by running:
flutter pub get
Usage
Initialize the Plugin
Import the plugin:
import 'package:adivery/adivery.dart'; import 'package:adivery/adivery_ads.dart';
Initialize in the initState method:
@override void initState() { super.initState(); AdiveryPlugin.initialize('APP_ID'); // Replace APP_ID with your app ID. }
Show Interstitial Ads 1. Prepare the ad:
AdiveryPlugin.prepareInterstitialAd('PLACEMENT_ID');
2. Display the ad:
void _showInterstitial() { AdiveryPlugin.isLoaded('PLACEMENT_ID').then((isLoaded) { if (isLoaded) { AdiveryPlugin.show('PLACEMENT_ID'); } }); }
Show Rewarded Ads 1. Prepare the rewarded ad:
AdiveryPlugin.prepareRewardedAd('PLACEMENT_ID');
2. Display the rewarded ad:
void _showRewarded() { AdiveryPlugin.isLoaded('PLACEMENT_ID').then((isLoaded) { if (isLoaded) { AdiveryPlugin.show('PLACEMENT_ID'); } }); }
3. Handle rewards:
AdiveryPlugin.addListener( onRewardedClosed: (placementId, isRewarded) { if (isRewarded) { print('Reward granted!'); } }, );
Show Banner Ads
To display banner ads:
BannerAd( 'PLACEMENT_ID', BannerAdSize.BANNER, // Options: BANNER, LARGE_BANNER, MEDIUM_RECTANGLE onAdLoaded: (ad) { print('Banner ad loaded.'); }, onAdClicked: (ad) { print('Banner ad clicked.'); }, );
Show Native Ads 1. Load the native ad:
NativeAd nativeAd = NativeAd( 'PLACEMENT_ID', onAdLoaded: () { print('Native ad loaded.'); }, );
nativeAd.loadAd();
2. Display the native ad:
Widget buildNativeAd() { if (nativeAd.isLoaded) { return Column( children: [ Row( children: [ Flexible( child: Text(nativeAd.headline ?? ''), ), nativeAd.icon ?? Container(), ], ), nativeAd.image ?? Container(), ElevatedButton( onPressed: () { nativeAd.recordClick(); }, child: Text(nativeAd.callToAction ?? ''), ), ], ); } else { return Container(); } }
3. Record clicks:
nativeAd.recordClick();
License
This plugin is licensed under the MIT License. See the LICENSE file for more details.