setup static method

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

Implementation

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