WhenInViewport class

Use this class to when you want to asynchronously load the ad and additionally check if it's in the viewport (+- pixelOffset).

checkIfInViewport pass null events, to trigger checking if the BannerAdView is in the viewport (+- pixelOffset). For example, the events could be generated by a NotificationListener, so that on every scroll, you would check if the BannerAdView is in the viewport. pixelOffset number of pixels that is used to calculate when to load the ad. NOTE: Bear in mind, that the BannerAdView should be added to the widget tree. So dynamic ListViews with a builder method could not catch -1000px offsets, because the BannerAdView is not rendered/created yet. Example values: If set to 0, the ad will load when the widget will enter the viewport. If set to -100, the ad will load -100 px before appearing on the screen. If set to 100, the ad will load when 100 px of the ad could be shown.

Use the factory method LoadMode.whenInViewport to create it.

Inheritance

Constructors

WhenInViewport({required Stream<ScrollPosition> checkIfInViewport, int? pixelOffset})
load ad when it's in the viewport

Properties

checkIfInViewport Stream<ScrollPosition>
stream which should get new events when scrolling changes
final
hashCode int
The hash code for this object.
no setterinherited
pixelOffset int
pixel offset determining when to load the ad
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited