notix_ads 0.0.3 copy "notix_ads: ^0.0.3" to clipboard
notix_ads: ^0.0.3 copied to clipboard

Effortlessly manage Banner and AppOpen Ads on Android Notix integration..

example/lib/main.dart

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

import 'package:flutter/services.dart';
import 'package:notix_ads/notix_ads.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
  Widget? _banner;
  final _notixAdsPlugin = NotixAds();

  @override
  void initState() {
    super.initState();
    WidgetsBinding.instance?.addObserver(this);
    initPlatformState();
  }

  @override
  void dispose() {
    WidgetsBinding.instance?.removeObserver(this);
    super.dispose();
  }

  @override
  void didChangeAppLifecycleState(AppLifecycleState state) {
    super.didChangeAppLifecycleState(state);
    if (state == AppLifecycleState.paused) {
      NotixAds().appOpen(/*You Zone ID*/);
    }
  }

  Future<void> initPlatformState() async {
    try {
      _banner = await _notixAdsPlugin.loadBanner(/*You Zone ID*/);
    } on PlatformException {
      _banner = const Text('Failed to get platform version.');
    }
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Notix_Ads'),
        ),
        body: Center(
          child: _banner,
        ),
      ),
    );
  }
}
0
likes
0
points
21
downloads

Publisher

verified publisherautolikerlive.com

Weekly Downloads

Effortlessly manage Banner and AppOpen Ads on Android Notix integration..

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on notix_ads