getAnchoredAdaptiveBannerAdSize static method

Future<AnchoredAdaptiveBannerAdSize?> getAnchoredAdaptiveBannerAdSize(
  1. Orientation orientation,
  2. int width
)

Ad units that render screen-width banner ads on any screen size across different devices in either Orientation.

Width of the current device can be found using: MediaQuery.of(context).size.width.truncate().

Returns null if a proper height could not be found for the device or window.

Implementation

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

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