setup static method

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

Implementation

static void setup(FlutterYandexAdsInterstitial? api, {BinaryMessenger? binaryMessenger}) {
  {
    final BasicMessageChannel<Object?> __pigeon_channel = BasicMessageChannel<Object?>(
        'dev.flutter.pigeon.flutter_yandex_ads.FlutterYandexAdsInterstitial.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.FlutterYandexAdsInterstitial.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.FlutterYandexAdsInterstitial.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.FlutterYandexAdsInterstitial.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.FlutterYandexAdsInterstitial.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.FlutterYandexAdsInterstitial.onAdFailedToLoad was null, expected non-null String.');
        final InterstitialError? arg_err = (args[1] as InterstitialError?);
        assert(arg_err != null,
            'Argument for dev.flutter.pigeon.flutter_yandex_ads.FlutterYandexAdsInterstitial.onAdFailedToLoad was null, expected non-null InterstitialError.');
        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.FlutterYandexAdsInterstitial.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.FlutterYandexAdsInterstitial.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.FlutterYandexAdsInterstitial.onAdFailedToShow was null, expected non-null String.');
        final InterstitialError? arg_err = (args[1] as InterstitialError?);
        assert(arg_err != null,
            'Argument for dev.flutter.pigeon.flutter_yandex_ads.FlutterYandexAdsInterstitial.onAdFailedToShow was null, expected non-null InterstitialError.');
        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.FlutterYandexAdsInterstitial.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.FlutterYandexAdsInterstitial.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.FlutterYandexAdsInterstitial.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.FlutterYandexAdsInterstitial.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.FlutterYandexAdsInterstitial.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.FlutterYandexAdsInterstitial.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.FlutterYandexAdsInterstitial.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.FlutterYandexAdsInterstitial.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.FlutterYandexAdsInterstitial.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.FlutterYandexAdsInterstitial.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.FlutterYandexAdsInterstitial.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.FlutterYandexAdsInterstitial.onImpression was null, expected non-null String.');
        final InterstitialImpression? arg_data = (args[1] as InterstitialImpression?);
        assert(arg_data != null,
            'Argument for dev.flutter.pigeon.flutter_yandex_ads.FlutterYandexAdsInterstitial.onImpression was null, expected non-null InterstitialImpression.');
        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()));
        }
      });
    }
  }
}