smartlinks_ad 2.0.1
smartlinks_ad: ^2.0.1 copied to clipboard
In-app ads (banner, interstitial, native) for the SmartLinks Flutter SDK.
example/lib/main.dart
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'package:smartlinks_flutter/smartlinks_flutter.dart';
import 'firebase_options.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
// Required only when enablePushAds: true
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
await SmartLinks.initialize(
apiKey: 'YOUR_API_KEY',
isDebug: true,
initializeAds: true,
enablePushAds: true,
);
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('SmartLinks Ad Example')),
body: const AdExample(),
),
);
}
}
class AdExample extends StatelessWidget {
const AdExample({super.key});
@override
Widget build(BuildContext context) {
return Column(
children: [
const Text('Banner Ad Below:'),
const SizedBox(height: 10),
SmartLinkBannerAd(adService: SmartLinks.ads, height: 100),
const Spacer(),
const Text('End of screen'),
],
);
}
}