setFullScreenAd method

Future<bool> setFullScreenAd({
  1. String? adUnitId,
  2. AdRequest? targetInfo,
  3. List<String>? keywords,
  4. String? contentUrl,
  5. bool? childDirected,
  6. List<String>? testDevices,
  7. bool? nonPersonalizedAds,
  8. bool? testing,
  9. MobileAdListener? listener,
  10. double? anchorOffset,
  11. double? horizontalCenterOffset,
  12. AdErrorListener? errorListener,
})

Set the Full Screen Ad options.

Implementation

Future<bool> setFullScreenAd({
  String? adUnitId,
  AdRequest? targetInfo,
  List<String>? keywords,
  String? contentUrl,
  bool? childDirected,
  List<String>? testDevices,
  bool? nonPersonalizedAds,
  bool? testing,
  m.MobileAdListener? listener,
  double? anchorOffset,
  double? horizontalCenterOffset,
//    AnchorType anchorType,
  m.AdErrorListener? errorListener,
}) async {
  // Can only have one instantiated Ads object.
  if (!_firstObject) {
    return Future.value(false);
  }

  if (listener != null) {
    screen.eventListeners.add(listener);
  }

  // Add this listener to the Error Listeners.
  if (errorListener != null) {
    m.eventErrorListeners.add(errorListener);
  }

  _fullScreenAd ??= m.FullScreenAd(listener: screen);

  // If an unit id is not provided, it may be available from the constructor.
  if (adUnitId == null || adUnitId.isEmpty || adUnitId.length < 30) {
    adUnitId = _screenUnitId;
  }

  return _fullScreenAd!.set(
    adUnitId: adUnitId,
    targetInfo: targetInfo,
    keywords: keywords ?? _keywords,
    contentUrl: contentUrl ?? _contentUrl,
    childDirected: childDirected ?? _childDirected,
    testDevices: testDevices ?? _testDevices,
    nonPersonalizedAds: nonPersonalizedAds ?? _nonPersonalizedAds,
    testing: testing ?? _testing,
    anchorOffset: anchorOffset ?? _anchorOffset,
    horizontalCenterOffset: horizontalCenterOffset ?? _horizontalCenterOffset,
//      anchorType: anchorType ?? _anchorType,
    errorListener: errorListener ?? _errorListener,
  );
}