Banner Cache

Integrate banner cache

Create placement

Create BannerCacheConfiguration object and call BannerCache.create method to create banner cache:

final bannerCacheConfiguration = BannerCacheConfiguration(
  "BannerCacheFlutter",
  size: 2,
  listener: CacheListener(
    firstBannerLoaded: () =>
        print("[BannerCacheFlutter] firstBannerLoaded"),
  ),
);
_bannerCache =
    await BannerCache.create(configuration: bannerCacheConfiguration);

Consume Banners

Next banner is consumed automatically when adding AATKitCachedBanner widget with passed BannerCache object as a parameter:

AATKitCachedBanner(
  bannerCache: _bannerCache,
  key: UniqueKey(),
)

Destroy old banner

Banner is destroyed automatically when AATKitBanner widget is no longer attached to the UI.

Destroy no longer needed BannerCache

For proper memory management, BannerCache needs to be destroyed when is no longer needed. The destroy method destroys the BannerCache:

_bannerCache.destroy();

Last updated