i have a flutter app. It's working on web browsers and mobile devices. I have added ad mob for showing banner ads. But i cant run the project because of google_mobile_ads doesn't support web. I'm starting google mobile ads if the current platform is a mobile device. I have an export.dart like this:
export 'ad_mobile.dart' if (dart.library.html) 'ad_web.dart';
ad_mobile.dart:
import 'package:google_mobile_ads/google_mobile_ads.dart';
Future<dynamic> initAds() async {
await _initGoogleMobileAds();
}
Future<InitializationStatus> _initGoogleMobileAds() {
RequestConfiguration configuration = RequestConfiguration(
testDeviceIds: <String>[
testDeviceId,
],);
MobileAds.instance.updateRequestConfiguration(configuration);
return MobileAds.instance.initialize();
}
and ad_web.dart is:
import 'dart:developer';
Future initAds() async {
log('ADS DOES\'NT SUPPORTED FOR WEB PLATFORMS');
}
When i run the app on Chrome, app starts but stuck at white screen. And i get this error on debug console:
Error: MissingPluginException(No implementation found for method _init on channel plugins.flutter.io/google_mobile_ads)