flutter_admob_kit library
High-level AdMob integration for Flutter.
Provides a unified, state-management-agnostic API for banner, interstitial, rewarded, and app-open ads with automatic UMP consent handling, test/production ID switching, retry with exponential backoff, and frequency capping.
Quick Start
import 'package:flutter_admob_kit/flutter_admob_kit.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
final adManager = AdManager(
config: AdConfig(
bannerId: AdUnitId(
android: 'ca-app-pub-xxxxx/banner-android',
ios: 'ca-app-pub-xxxxx/banner-ios',
),
),
);
await adManager.initialize();
runApp(MyApp(adManager: adManager));
}
See the README for detailed usage examples.
Classes
- AdConfig
- Configuration for the ad management system.
- AdError
- Ad loading error information.
- AdEvent
- An event emitted by the ad management system.
- AdManager
- Core entry point for ad management.
- AdPaidValue
- Revenue data from a paid ad event.
- AdReward
- Reward earned from watching a rewarded ad.
- AdUnitId
- Platform-specific ad unit ID pair.
- BannerAdWidget
- A widget that displays a banner ad.
- BannerAdWidgetState
- State for BannerAdWidget.
- ConsentManager
- Manages the UMP (User Messaging Platform) consent flow.
- FakeAdManager
- A fake AdManager for testing.
- FrequencyCap
- Frequency cap to limit how often an ad can be shown.
- InterstitialController
- Controller for interstitial ads with frequency capping.
- RetryStrategy
- Exponential backoff retry strategy for ad loading.
- RewardedController
- Controller for rewarded ads.
Enums
- AdEventType
- Types of ad events emitted by the ad management system.
- AdState
- The loading/display state of an ad.
- AdType
- The type of ad unit, used to select the correct test ID in debug builds.
- ConsentResult
- Result of a consent request.
- ConsentStatus
- UMP consent status.