multi_ads 1.0.1 copy "multi_ads: ^1.0.1" to clipboard
multi_ads: ^1.0.1 copied to clipboard

Multiple Ad Network

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:multi_ads/multi_ads.dart';
import 'package:multi_ads_example/home_screen.dart';
import 'package:multi_ads_example/second_screen.dart';
import 'package:multi_ads_example/splash_screen.dart';

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

class MyApp extends StatefulWidget {
  const MyApp({super.key});

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

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      initialRoute: "/",
      onGenerateRoute: (settings) {
        switch (settings.name) {
          case "/":
            return MaterialPageRoute(
              settings: settings,
              builder: (context) => const SplashScreen(),
            );
          case "/home":
            return MaterialPageRoute(
              settings: settings,
              builder: (context) => const HomeScreen(),
            );
          case "/screen1":
            return MaterialPageRoute(
              settings: settings,
              builder: (context) => const SecondScreen(),
            );
          default:
            return MaterialPageRoute(
              settings: settings,
              builder: (context) => const HomeScreen(),
            );
        }
      },
    );
  }
}