Skip to main content

adpluga_flutter 0.7.4 copy "adpluga_flutter: ^0.7.4" to clipboard
adpluga_flutter: ^0.7.4 copied to clipboard

Banner, native, interstitial, rewarded, video and carousel ads for Flutter apps, served by adPluga. No traffic minimum; a test key shows real ads with no charges.

example/lib/main.dart

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

// The public demo key: test mode, nothing is charged. Replace both with your
// own key and slot id from the dashboard.
const publishableKey = 'pk_test_kvhgusa3wauuklgogatyovhbohlpc';
const slotId = '35490c85-1933-4764-bf04-647005ea6db5';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await AdPluga.initialize(publisherKey: publishableKey);
  runApp(const ExampleApp());
}

class ExampleApp extends StatelessWidget {
  const ExampleApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(title: 'adPluga example', home: HomePage());
  }
}

class HomePage extends StatelessWidget {
  const HomePage({super.key});

  Future<void> _showInterstitial(BuildContext context) async {
    try {
      final ad = await InterstitialAd.load(slotId: slotId);
      if (!context.mounted) return;
      await ad.show(context);
    } on AdPlugaError catch (e) {
      debugPrint('adpluga: $e');
    }
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('adPluga in Flutter')),
      body: Center(
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            AdPlugaBanner(
              slotId: slotId,
              onError: (err) => debugPrint('adpluga: $err'),
            ),
            const SizedBox(height: 24),
            FilledButton(
              onPressed: () => _showInterstitial(context),
              child: const Text('Show an interstitial'),
            ),
          ],
        ),
      ),
    );
  }
}
1
likes
160
points
614
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Banner, native, interstitial, rewarded, video and carousel ads for Flutter apps, served by adPluga. No traffic minimum; a test key shows real ads with no charges.

Homepage
Repository (GitHub)
View/report issues

Topics

#ads #advertising #monetization #banner #ad-network

License

Apache-2.0 (license)

Dependencies

flutter, http, meta, url_launcher, video_player, webview_flutter

More

Packages that depend on adpluga_flutter