AppInterstitialAd.fromKey constructor

AppInterstitialAd.fromKey({
  1. required String configKey,
})

Setup InterstitialAd handle by key from firebase remote config configKey is key of config you save in firebase remote config

Implementation

factory AppInterstitialAd.fromKey({required String configKey}) {
  try {
    final data = FirebaseRemoteConfig.instance.getString(configKey);
    final json = jsonDecode(data);
    final config = InterstitialConfig.fromJson(json);
    return AppInterstitialAd.setup(config: config);
  } catch (e, st) {
    log('', name: 'AppInterstitialAd.fromKey', error: e, stackTrace: st);
    return AppInterstitialAd.setup(config: InterstitialConfig());
  }
}