setup static method

void setup(
  1. FlutterYandexAdsRewarded? api, {
  2. BinaryMessenger? binaryMessenger,
})

Implementation

static void setup(FlutterYandexAdsRewarded? api, {BinaryMessenger? binaryMessenger}) {
  {
    final BasicMessageChannel<Object?> __pigeon_channel = BasicMessageChannel<Object?>(
        'dev.flutter.pigeon.flutter_yandex_ads.FlutterYandexAdsRewarded.onAdLoaded', pigeonChannelCodec,
        binaryMessenger: binaryMessenger);
    if (api == null) {
      __pigeon_channel.setMessageHandler(null);
    } else {
      __pigeon_channel.setMessageHandler((Object? message) async {
        assert(message != null,
        'Argument for dev.flutter.pigeon.flutter_yandex_ads.FlutterYandexAdsRewarded.onAdLoaded was null.');
        final List<Object?> args = (message as List<Object?>?)!;
        final String? arg_id = (args[0] as String?);
        assert(arg_id != null,
            'Argument for dev.flutter.pigeon.flutter_yandex_ads.FlutterYandexAdsRewarded.onAdLoaded was null, expected non-null String.');
        try {
          api.onAdLoaded(arg_id!);
          return wrapResponse(empty: true);
        } on PlatformException catch (e) {
          return wrapResponse(error: e);
        }          catch (e) {
          return wrapResponse(error: PlatformException(code: 'error', message: e.toString()));
        }
      });
    }
  }
  {
    final BasicMessageChannel<Object?> __pigeon_channel = BasicMessageChannel<Object?>(
        'dev.flutter.pigeon.flutter_yandex_ads.FlutterYandexAdsRewarded.onAdFailedToLoad', pigeonChannelCodec,
        binaryMessenger: binaryMessenger);
    if (api == null) {
      __pigeon_channel.setMessageHandler(null);
    } else {
      __pigeon_channel.setMessageHandler((Object? message) async {
        assert(message != null,
        'Argument for dev.flutter.pigeon.flutter_yandex_ads.FlutterYandexAdsRewarded.onAdFailedToLoad was null.');
        final List<Object?> args = (message as List<Object?>?)!;
        final String? arg_id = (args[0] as String?);
        assert(arg_id != null,
            'Argument for dev.flutter.pigeon.flutter_yandex_ads.FlutterYandexAdsRewarded.onAdFailedToLoad was null, expected non-null String.');
        final RewardedError? arg_err = (args[1] as RewardedError?);
        assert(arg_err != null,
            'Argument for dev.flutter.pigeon.flutter_yandex_ads.FlutterYandexAdsRewarded.onAdFailedToLoad was null, expected non-null RewardedError.');
        try {
          api.onAdFailedToLoad(arg_id!, arg_err!);
          return wrapResponse(empty: true);
        } on PlatformException catch (e) {
          return wrapResponse(error: e);
        }          catch (e) {
          return wrapResponse(error: PlatformException(code: 'error', message: e.toString()));
        }
      });
    }
  }
  {
    final BasicMessageChannel<Object?> __pigeon_channel = BasicMessageChannel<Object?>(
        'dev.flutter.pigeon.flutter_yandex_ads.FlutterYandexAdsRewarded.onAdFailedToShow', pigeonChannelCodec,
        binaryMessenger: binaryMessenger);
    if (api == null) {
      __pigeon_channel.setMessageHandler(null);
    } else {
      __pigeon_channel.setMessageHandler((Object? message) async {
        assert(message != null,
        'Argument for dev.flutter.pigeon.flutter_yandex_ads.FlutterYandexAdsRewarded.onAdFailedToShow was null.');
        final List<Object?> args = (message as List<Object?>?)!;
        final String? arg_id = (args[0] as String?);
        assert(arg_id != null,
            'Argument for dev.flutter.pigeon.flutter_yandex_ads.FlutterYandexAdsRewarded.onAdFailedToShow was null, expected non-null String.');
        final RewardedError? arg_err = (args[1] as RewardedError?);
        assert(arg_err != null,
            'Argument for dev.flutter.pigeon.flutter_yandex_ads.FlutterYandexAdsRewarded.onAdFailedToShow was null, expected non-null RewardedError.');
        try {
          api.onAdFailedToShow(arg_id!, arg_err!);
          return wrapResponse(empty: true);
        } on PlatformException catch (e) {
          return wrapResponse(error: e);
        }          catch (e) {
          return wrapResponse(error: PlatformException(code: 'error', message: e.toString()));
        }
      });
    }
  }
  {
    final BasicMessageChannel<Object?> __pigeon_channel = BasicMessageChannel<Object?>(
        'dev.flutter.pigeon.flutter_yandex_ads.FlutterYandexAdsRewarded.onAdShown', pigeonChannelCodec,
        binaryMessenger: binaryMessenger);
    if (api == null) {
      __pigeon_channel.setMessageHandler(null);
    } else {
      __pigeon_channel.setMessageHandler((Object? message) async {
        assert(message != null,
        'Argument for dev.flutter.pigeon.flutter_yandex_ads.FlutterYandexAdsRewarded.onAdShown was null.');
        final List<Object?> args = (message as List<Object?>?)!;
        final String? arg_id = (args[0] as String?);
        assert(arg_id != null,
            'Argument for dev.flutter.pigeon.flutter_yandex_ads.FlutterYandexAdsRewarded.onAdShown was null, expected non-null String.');
        try {
          api.onAdShown(arg_id!);
          return wrapResponse(empty: true);
        } on PlatformException catch (e) {
          return wrapResponse(error: e);
        }          catch (e) {
          return wrapResponse(error: PlatformException(code: 'error', message: e.toString()));
        }
      });
    }
  }
  {
    final BasicMessageChannel<Object?> __pigeon_channel = BasicMessageChannel<Object?>(
        'dev.flutter.pigeon.flutter_yandex_ads.FlutterYandexAdsRewarded.onAdDismissed', pigeonChannelCodec,
        binaryMessenger: binaryMessenger);
    if (api == null) {
      __pigeon_channel.setMessageHandler(null);
    } else {
      __pigeon_channel.setMessageHandler((Object? message) async {
        assert(message != null,
        'Argument for dev.flutter.pigeon.flutter_yandex_ads.FlutterYandexAdsRewarded.onAdDismissed was null.');
        final List<Object?> args = (message as List<Object?>?)!;
        final String? arg_id = (args[0] as String?);
        assert(arg_id != null,
            'Argument for dev.flutter.pigeon.flutter_yandex_ads.FlutterYandexAdsRewarded.onAdDismissed was null, expected non-null String.');
        try {
          api.onAdDismissed(arg_id!);
          return wrapResponse(empty: true);
        } on PlatformException catch (e) {
          return wrapResponse(error: e);
        }          catch (e) {
          return wrapResponse(error: PlatformException(code: 'error', message: e.toString()));
        }
      });
    }
  }
  {
    final BasicMessageChannel<Object?> __pigeon_channel = BasicMessageChannel<Object?>(
        'dev.flutter.pigeon.flutter_yandex_ads.FlutterYandexAdsRewarded.onAdClicked', pigeonChannelCodec,
        binaryMessenger: binaryMessenger);
    if (api == null) {
      __pigeon_channel.setMessageHandler(null);
    } else {
      __pigeon_channel.setMessageHandler((Object? message) async {
        assert(message != null,
        'Argument for dev.flutter.pigeon.flutter_yandex_ads.FlutterYandexAdsRewarded.onAdClicked was null.');
        final List<Object?> args = (message as List<Object?>?)!;
        final String? arg_id = (args[0] as String?);
        assert(arg_id != null,
            'Argument for dev.flutter.pigeon.flutter_yandex_ads.FlutterYandexAdsRewarded.onAdClicked was null, expected non-null String.');
        try {
          api.onAdClicked(arg_id!);
          return wrapResponse(empty: true);
        } on PlatformException catch (e) {
          return wrapResponse(error: e);
        }          catch (e) {
          return wrapResponse(error: PlatformException(code: 'error', message: e.toString()));
        }
      });
    }
  }
  {
    final BasicMessageChannel<Object?> __pigeon_channel = BasicMessageChannel<Object?>(
        'dev.flutter.pigeon.flutter_yandex_ads.FlutterYandexAdsRewarded.onImpression', pigeonChannelCodec,
        binaryMessenger: binaryMessenger);
    if (api == null) {
      __pigeon_channel.setMessageHandler(null);
    } else {
      __pigeon_channel.setMessageHandler((Object? message) async {
        assert(message != null,
        'Argument for dev.flutter.pigeon.flutter_yandex_ads.FlutterYandexAdsRewarded.onImpression was null.');
        final List<Object?> args = (message as List<Object?>?)!;
        final String? arg_id = (args[0] as String?);
        assert(arg_id != null,
            'Argument for dev.flutter.pigeon.flutter_yandex_ads.FlutterYandexAdsRewarded.onImpression was null, expected non-null String.');
        final RewardedImpression? arg_data = (args[1] as RewardedImpression?);
        assert(arg_data != null,
            'Argument for dev.flutter.pigeon.flutter_yandex_ads.FlutterYandexAdsRewarded.onImpression was null, expected non-null RewardedImpression.');
        try {
          api.onImpression(arg_id!, arg_data!);
          return wrapResponse(empty: true);
        } on PlatformException catch (e) {
          return wrapResponse(error: e);
        }          catch (e) {
          return wrapResponse(error: PlatformException(code: 'error', message: e.toString()));
        }
      });
    }
  }
  {
    final BasicMessageChannel<Object?> __pigeon_channel = BasicMessageChannel<Object?>(
        'dev.flutter.pigeon.flutter_yandex_ads.FlutterYandexAdsRewarded.onRewarded', pigeonChannelCodec,
        binaryMessenger: binaryMessenger);
    if (api == null) {
      __pigeon_channel.setMessageHandler(null);
    } else {
      __pigeon_channel.setMessageHandler((Object? message) async {
        assert(message != null,
        'Argument for dev.flutter.pigeon.flutter_yandex_ads.FlutterYandexAdsRewarded.onRewarded was null.');
        final List<Object?> args = (message as List<Object?>?)!;
        final String? arg_id = (args[0] as String?);
        assert(arg_id != null,
            'Argument for dev.flutter.pigeon.flutter_yandex_ads.FlutterYandexAdsRewarded.onRewarded was null, expected non-null String.');
        final RewardedEvent? arg_reward = (args[1] as RewardedEvent?);
        assert(arg_reward != null,
            'Argument for dev.flutter.pigeon.flutter_yandex_ads.FlutterYandexAdsRewarded.onRewarded was null, expected non-null RewardedEvent.');
        try {
          api.onRewarded(arg_id!, arg_reward!);
          return wrapResponse(empty: true);
        } on PlatformException catch (e) {
          return wrapResponse(error: e);
        }          catch (e) {
          return wrapResponse(error: PlatformException(code: 'error', message: e.toString()));
        }
      });
    }
  }
}