# Events

There is a bunch of events which informs you about the placement state. For example you can figure out when placement is loaded by registering function to the `onHaveAd` field of the `AATKitBinding` object, like:

```dart
  @override
  void initState() {
    super.initState();
    _aatKitBinding.onHaveAd = (placementName) {
      print("[Home Page] onHaveAd placementName: $placementName");
    };
  }
```

#### Function(String)? onHaveAd <a href="#markdown-header-functionstring-onhavead" id="markdown-header-functionstring-onhavead"></a>

Notifies that placement has finished loading an ad successfully.

```dart
  @override
  void initState() {
    super.initState();da
    _aatKitBinding.onHaveAd = (placementName) {
      print("[Home Page] onHaveAd placementName: $placementName");
    };
  }
```

#### Function(String)? onNoAd <a href="#markdown-header-functionstring-onnoad" id="markdown-header-functionstring-onnoad"></a>

Notifies that placement has failed to load an ad.

```dart
  @override
  void initState() {
    super.initState();
    _aatKitBinding.onNoAd = (placementName) {
      print("[Home Page] onNoAd placementName: $placementName");
    };
  }
```

#### Function(String)? onPauseForAd <a href="#markdown-header-functionstring-onpauseforad" id="markdown-header-functionstring-onpauseforad"></a>

Notifies that ad went fullscreen and that application should pause.

```dart
  @override
  void initState() {
    super.initState();
    _aatKitBinding.onPauseForAd = (placementName) {
      print("[Home Page] onPauseForAd placementName: $placementName");
    };
  }
```

#### Function(String)? onResumeAfterAd <a href="#markdown-header-functionstring-onresumeafterad" id="markdown-header-functionstring-onresumeafterad"></a>

Notifies that ad came back from fullscreen and that application should resume.

```dart
  @override
  void initState() {
    super.initState();
    _aatKitBinding.onResumeAfterAd = (placementName) {
      print("[Home Page] onResumeAfterAd placementName: $placementName");
    };
  }
```

#### Function(AATKitReward)? onUserEarnedIncentive <a href="#markdown-header-functionaatkitreward-onuserearnedincentive" id="markdown-header-functionaatkitreward-onuserearnedincentive"></a>

Notifies that placement has earned incentive (by rewarded ads)

```dart
  @override
  void initState() {
    super.initState();
    _aatKitBinding.onUserEarnedIncentive = (reward) {
      print("[Home Page] onUserEarnedIncentive "
          "placementName: ${reward.placementName} "
          "rewardName: ${reward.rewardName} "
          "rewardValue: ${reward.rewardValue} ");
    };
  }
```

#### Function(AATKitConsentState)? managedConsentCMPFinished <a href="#markdown-header-functionaatkitconsentstate-managedconsentcmpfinished" id="markdown-header-functionaatkitconsentstate-managedconsentcmpfinished"></a>

Notifies that the used CMP has finished updating consent.

```dart
  @override
  void initState() {
    super.initState();
    _aatKitBinding.managedConsentCMPFinished = (state) {
      print("[Home Page] managedConsentCMPFinished state: $state");
    };
  }
```

#### Function()? managedConsentNeedsUserInterface <a href="#markdown-header-function-managedconsentneedsuserinterface" id="markdown-header-function-managedconsentneedsuserinterface"></a>

Notifies that Managed Consent needs to show a consent dialog.

```dart
  @override
  void initState() {
    super.initState();
    _aatKitBinding.managedConsentNeedsUserInterface = () {
      print("[Home Page] managedConsentNeedsUserInterface");
    };
  }
```

#### Function(String)? managedConsentCMPFailedToShow <a href="#markdown-header-functionstring-managedconsentcmpfailedtoshow" id="markdown-header-functionstring-managedconsentcmpfailedtoshow"></a>

Notifies that the used CMP failed to show.

```dart
  @override
  void initState() {
    super.initState();
    _aatKitBinding.managedConsentCMPFailedToShow = (error) {
      print("[Home Page] managedConsentCMPFailedToShow error: $error");
    };
  }
```

#### Function(String)? managedConsentCMPFailedToLoad <a href="#markdown-header-functionstring-managedconsentcmpfailedtoload" id="markdown-header-functionstring-managedconsentcmpfailedtoload"></a>

Notifies that the used CMP failed to load.

```dart
  @override
  void initState() {
    super.initState();
    _aatKitBinding.managedConsentCMPFailedToLoad = (error) {
      print("[Home Page] managedConsentCMPFailedToLoad error: $error");
    };
  }
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://aatkit.gitbook.io/aatkit-flutter-binding/other/events.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
