# Rewarded

## Integración

A continuación se muestra un sencillo ejemplo para entender el funcionamiento de los anuncios recompensados:

```dart
import 'package:wortise/rewarded_ad.dart';

RewardedAd _rewardedAd;

// Se crea un recompensado
_rewardedAd = RewardedAd('Ad Unit ID de Wortise', listener: (event, args) {
  // Este listener será invocado cuando se produzca algún evento
});

// Se solicita la carga de un anuncio
await _rewardedAd.loadAd();

/* ... */

// Se muestra el anuncio si está disponible
if (await _rewardedAd.isAvailable) {
  await _rewardedAd.showAd();
}
```

El constructor de la clase `RewardedAd` admite un tercer parámetro, llamado `reloadOnDismissed`, que al establecerse a `true` (el valor por defecto es `false`) permite que el recompensado cargue automáticamente un nuevo anuncio cuando se finalice de mostrar el actual.

## **Eventos del listener**

El listener asignado a un `RewardedAd` puede recibir los siguientes eventos:

```dart
// El anuncio ha sido clickeado
RewardedAdEvent.CLICKED
// El anuncio ha sido completado
// (los argumentos 'amount', 'label' y 'success' son especificados)
RewardedAdEvent.COMPLETED
// El anuncio ha sido cerrado
RewardedAdEvent.DISMISSED
// El anuncio no se ha podido cargar
RewardedAdEvent.FAILED_TO_LOAD
// El anuncio no se ha podido mostrar
RewardedAdEvent.FAILED_TO_SHOW
// El anuncio ha generado una impresión
RewardedAdEvent.IMPRESSION
// El anuncio ha sido cargado
RewardedAdEvent.LOADED
// El anuncio ha generado un ingreso
RewardedAdEvent.REVENUE_PAID
// El anuncio ha sido mostrado
RewardedAdEvent.SHOWN
```

A continuación,  se muestra un pequeño ejemplo para obtener la recompensa una vez el anuncio ha sido completado con éxito:

```dart
(event, args) {
  if (event == RewardedAdEvent.COMPLETED) {
    int    amount  = args['amount'];
    String label   = args['label'];
    bool   success = args['success'];
    
    ...
  }
});
```


---

# 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://docs.wortise.com/flutter-sdk/integracion-del-sdk/rewarded.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.
