AppBannerAd.fromKey constructor
AppBannerAd.fromKey({
- required String configKey,
- AdSize? size,
The BannerAd with config from Firebase Remote Config
configKey is key you save config on firebase
size is AdSize follow Google AdSize, if not provider size, the widget
will get size from remote config
Implementation
factory AppBannerAd.fromKey({required String configKey, AdSize? size}) {
try {
final data = FirebaseRemoteConfig.instance.getString(configKey);
final json = jsonDecode(data);
final config = BannerConfig.fromJson(json);
return AppBannerAd(config: config, size: size);
} catch (e, st) {
log('', name: 'AppBannerAd.fromKey', error: e, stackTrace: st);
return AppBannerAd(config: BannerConfig(), size: size);
}
}