premium_ads 0.2.6
premium_ads: ^0.2.6 copied to clipboard
Flutter plugin for Premium Ads (AdMob/AdManager adapter)
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:premium_ads/premium_ads.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
// Enable debug mode for development
await PremiumAds.setDebug(true);
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
bool _debugEnabled = true;
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('Premium Ads Example')),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text('Premium Ads Plugin Demo'),
const SizedBox(height: 20),
Text('Debug Mode: ${_debugEnabled ? "ON" : "OFF"}'),
const SizedBox(height: 20),
ElevatedButton(
onPressed: () async {
setState(() {
_debugEnabled = !_debugEnabled;
});
await PremiumAds.setDebug(_debugEnabled);
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('Debug mode ${_debugEnabled ? "enabled" : "disabled"}'),
duration: const Duration(seconds: 2),
),
);
}
},
child: Text(_debugEnabled ? 'Disable Debug' : 'Enable Debug'),
),
],
),
),
),
);
}
}