getCurrentOrientationAnchoredAdaptiveBannerAdSize static method

Future<AnchoredAdaptiveBannerAdSize?> getCurrentOrientationAnchoredAdaptiveBannerAdSize(
  1. int width
)

Returns an AdSize with the given width and a Google-optimized height to create a banner ad.

The size returned will have an aspect ratio similar to AdSize, suitable for anchoring near the top or bottom of your app. The height will never be larger than 15% of the device's current orientation height and never smaller than 50px. This function always returns the same height for any width / device combination. For more details, visit: https://developers.google.com/android/reference/com/google/android/gms/ads/AdSize#getCurrentOrientationAnchoredAdaptiveBannerAdSize(android.content.Context,%20int)

Implementation

static Future<AnchoredAdaptiveBannerAdSize?>
    getCurrentOrientationAnchoredAdaptiveBannerAdSize(int width) async {
  final num? height = await instanceManager.channel.invokeMethod<num?>(
    'AdSize#getAnchoredAdaptiveBannerAdSize',
    <String, Object?>{
      'width': width,
    },
  );

  if (height == null) return null;
  return AnchoredAdaptiveBannerAdSize(
    null,
    width: width,
    height: height.truncate(),
  );
}