adflow_flutter 0.5.0 copy "adflow_flutter: ^0.5.0" to clipboard
adflow_flutter: ^0.5.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 'ad_placements.dart';
import 'home_screen.dart';
import 'splash_screen.dart';

late final AdPlacements placements;

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await AdFlowCore.initialize();
  placements = AdPlacements();
  await placements.appOpen.enableAutoShowOnForeground();
  // Không chờ resolve consent/load() xong mới runApp() - chạy song song ở background, giống
  // MainActivity.kt bản Kotlin gốc. load() tự động tôn trọng consent (xem README), nên thứ tự
  // "xin consent rồi mới load" ở đây chỉ để tránh lãng phí 1 request, không phải điều kiện bắt buộc.
  unawaited(AdFlowCore.requestConsentIfNeeded().then((_) => placements.loadAll()));
  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) {
    return MaterialApp(
      home: _showSplash
          ? SplashScreen(
              placements: placements,
              onDone: () => setState(() => _showSplash = false),
            )
          : HomeScreen(placements: placements),
    );
  }
}
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