This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Future<void> main() async { | |
WidgetsFlutterBinding.ensureInitialized(); | |
final initFuture = MobileAds.instance.initialize(); | |
final adState = AdState(initFuture); | |
runApp(Provider.value( | |
value: adState, | |
builder: (context, child) => const MyApp(), | |
)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<manifest> | |
<application> | |
<meta-data | |
android:name="com.google.android.gms.ads.APPLICATION_ID" | |
android:value="ca-app-pub-3940256099942544~3347511713"/> | |
</application> | |
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/cupertino.dart'; | |
import 'package:google_mobile_ads/google_mobile_ads.dart'; | |
import 'dart:io'; | |
class AdState { | |
Future<InitializationStatus> initialization; | |
AdState(this.initialization); | |
String? get bannerAdUnitId => Platform.isAndroid | |
? 'ca-app-pub-3940256099942544/6300978111' // Test AdUnitId. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:connectivity_plus/connectivity_plus.dart'; | |
import 'package:flutter/cupertino.dart'; | |
import 'package:flutter/services.dart'; | |
// Platform messages are asynchronous, so we initialize in an async method. | |
Future<ConnectivityResult?> initConnectivity( | |
{required Connectivity connectivity}) async { | |
// Platform messages may fail, so we use a try/catch PlatformException. | |
try { | |
return await connectivity.checkConnectivity(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:google_mobile_ads/google_mobile_ads.dart'; | |
import 'package:provider/provider.dart'; | |
import 'ads/ad_state.dart'; | |
import 'ads/banner_ad.dart'; | |
import 'ads/banner_ad_customised.dart'; | |
Future<void> main() async { | |
WidgetsFlutterBinding.ensureInitialized(); | |
final initFuture = MobileAds.instance.initialize(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:google_mobile_ads/google_mobile_ads.dart'; | |
import 'package:provider/provider.dart'; | |
import 'ads/ad_state.dart'; | |
import 'ads/banner_ad.dart'; | |
import 'ads/banner_ad_customised.dart'; | |
Future<void> main() async { | |
WidgetsFlutterBinding.ensureInitialized(); | |
final initFuture = MobileAds.instance.initialize(); |
OlderNewer