adflow_flutter 2.2.0 copy "adflow_flutter: ^2.2.0" to clipboard
adflow_flutter: ^2.2.0 copied to clipboard

PlatformAndroid

Flutter plugin for the AdFlow ad-mediation library on top of AdMob: Interstitial, App Open, Rewarded, Native, and Banner ads. Android only for now.

example/lib/main.dart

import 'dart:async';

import 'package:adflow_flutter/adflow_flutter.dart';
import 'package:flutter/material.dart';

import 'home_screen.dart';
import 'splash_screen.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await AdFlow.initialize(
    showInterval: const ShowIntervalConfig(
      interstitialAfterInterstitialMs: 5000,
      appOpenAfterAppOpenMs: 5000,
      interstitialAfterAppOpenMs: 5000,
      appOpenAfterInterstitialMs: 5000,
    ),
    placements: const [
      InterstitialPlacement(
        'splash_interstitial',
        adUnits: ['ca-app-pub-3940256099942544/1033173712'],
        preload: false,
      ),
      InterstitialPlacement(
        'global_interstitial',
        adUnits: ['ca-app-pub-3940256099942544/1033173712'],
      ),
      AppOpenPlacement(
        'app_open',
        adUnits: ['ca-app-pub-3940256099942544/9257395921'],
        autoShowOnForeground: true,
      ),
      RewardedPlacement(
        'rewarded',
        adUnits: ['ca-app-pub-3940256099942544/5224354917'],
      ),
      BannerPlacement(
        'home_banner',
        adUnits: ['ca-app-pub-3940256099942544/6300978111'],
        size: BannerSize.banner,
      ),
      NativePlacement(
        'home_native',
        adUnits: ['ca-app-pub-3940256099942544/2247696110'],
      ),
      NativePlacement(
        'feed_native',
        adUnits: ['ca-app-pub-3940256099942544/2247696110'],
        rendererId: 'compactCard',
      ),
      NativePlacement(
        'small_native',
        adUnits: ['ca-app-pub-3940256099942544/2247696110'],
        rendererId: 'small',
      ),
      NativePlacement(
        'xml_native',
        adUnits: ['ca-app-pub-3940256099942544/2247696110'],
        rendererId: 'xmlCard',
      ),
    ],
  );
  unawaited(AdFlow.requestConsentIfNeeded());
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});
  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  bool _showSplash = true;

  @override
  Widget build(BuildContext context) => MaterialApp(
    home: _showSplash
        ? SplashScreen(onDone: () => setState(() => _showSplash = false))
        : const HomeScreen(),
  );
}
0
likes
160
points
103
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Flutter plugin for the AdFlow ad-mediation library on top of AdMob: Interstitial, App Open, Rewarded, Native, and Banner ads. Android only for now.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter, meta

More

Packages that depend on adflow_flutter

Packages that implement adflow_flutter