> For the complete documentation index, see [llms.txt](https://aatkit.gitbook.io/aatkit-flutter-binding/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://aatkit.gitbook.io/aatkit-flutter-binding/formats/banner-cache.md).

# Banner Cache

### Note <a href="#markdown-header-creating-placement" id="markdown-header-creating-placement"></a>

Banner cache is currently only available on the [3.3-beta-release](https://bitbucket.org/addapptr/flutter-binding/src/3.3-beta-release/) branch.

### Create Banner Cache

To create banner cache, call `createBannerCache` method:

```dart
_aatKitBinding.createBannerCache()
```

You can change the cache configuration if needed. Please modify corresponding variables or pass more parameters to the constructor of `BannerCacheConfiguration` (Android) or`AATBannerCacheConfiguration` (iOS):

{% code title="AATKitBinding.kt" %}

```kotlin
    //Change banner cache configuration if needed
    private val bannerCachePlacementName = "bannerCachePlacement"
    private val bannerCacheSize = 2
    
    ...
    
    private fun createBannerCache() {
        //Set more parameters of BannerCacheConfiguration if needed
        val configuration = BannerCacheConfiguration(bannerCachePlacementName, bannerCacheSize)
        configuration.delegate = bannerCacheListener
        bannerCache = AATKit.createBannerCache(configuration)
    }
```

{% endcode %}

{% code title="AATKitBinding.swift" %}

```swift
    //Change banner cache parameters if needed
    private let bannerCachePlacementName = "bannerCachePlacement"
    private let bannerCacheSize = 2
    
    ...
    
    
    private func createBannerCache() {
        //Set more parameters of AATBannerCacheConfiguration if needed
        let configuration = AATBannerCacheConfiguration(placementName: bannerCachePlacementName, size: bannerCacheSize)
        configuration.delegate = bannerCacheDelegate
        Self.bannerCache = AATSDK.createBannerCache(configuration: configuration)
    }
```

{% endcode %}

### Consume Banners

Next banner is consumed automatically when adding `AATKitBanner` widget with passed `type` parameter as `AATKitBannerType.cached:`

```dart
AATKitBanner(
  type: AATKitBannerType.cached,
)
```

### Destroy old banner

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

### Destroy no longer needed BannerCache <a href="#markdown-header-destroy-no-longer-needed-bannercache" id="markdown-header-destroy-no-longer-needed-bannercache"></a>

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

```dart
_aatKitBinding.destroyBannerCache();
```

### Code Example

Please see [list\_page.dart](https://bitbucket.org/addapptr/flutter-binding/src/3.3-beta-release/lib/pages/list_page.dart) to check how banner cache is integrated within `ListView` widget. Please note our example app requires to call creating banner cache manually by pressing the `Create banner cache` button from the [home\_page.dart](https://bitbucket.org/addapptr/flutter-binding/src/3.3-beta-release/lib/pages/home_page.dart).
