setEnabled method

  1. @Deprecated("If you want more precise control over ad memory, you should switch to using the new CAS classes for each format.")
Future<void> setEnabled(
  1. int adType,
  2. bool isEnable
)

Set enabled ad type to processing. The state will not be saved between sessions.

Implementation

@Deprecated(
    "If you want more precise control over ad memory, you should switch to using the new CAS classes for each format.")
Future<void> setEnabled(int adType, bool isEnable) async {
  final bool autoload =
      isEnable && !casInternalBridge.deprecatedManualLoadUsed;
  if (adType & AdTypeFlags.interstitial == AdTypeFlags.interstitial) {
    _isInterstitialAutoload = isEnable;
    if (_interstitial != null) {
      await _interstitial?.setAutoloadEnabled(autoload);
    } else if (autoload) {
      await loadInterstitial();
    }
  }
  if (adType & AdTypeFlags.rewarded == AdTypeFlags.rewarded) {
    _isRewardedAutoload = isEnable;
    if (_rewarded != null) {
      await _rewarded?.setAutoloadEnabled(autoload);
    } else if (autoload) {
      await loadInterstitial();
    }
  }
}