setup static method

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

Implementation

static void setup(RuStorePushCallbacks? api, {BinaryMessenger? binaryMessenger}) {
  {
    final BasicMessageChannel<Object?> __pigeon_channel = BasicMessageChannel<Object?>(
        'dev.flutter.pigeon.flutter_rustore_push.RuStorePushCallbacks.newToken', 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_rustore_push.RuStorePushCallbacks.newToken was null.');
        final List<Object?> args = (message as List<Object?>?)!;
        final String? arg_token = (args[0] as String?);
        assert(arg_token != null,
            'Argument for dev.flutter.pigeon.flutter_rustore_push.RuStorePushCallbacks.newToken was null, expected non-null String.');
        try {
          await api.newToken(arg_token!);
          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_rustore_push.RuStorePushCallbacks.messageReceived', 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_rustore_push.RuStorePushCallbacks.messageReceived was null.');
        final List<Object?> args = (message as List<Object?>?)!;
        final Message? arg_message = (args[0] as Message?);
        assert(arg_message != null,
            'Argument for dev.flutter.pigeon.flutter_rustore_push.RuStorePushCallbacks.messageReceived was null, expected non-null Message.');
        try {
          await api.messageReceived(arg_message!);
          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_rustore_push.RuStorePushCallbacks.deletedMessages', pigeonChannelCodec,
        binaryMessenger: binaryMessenger);
    if (api == null) {
      __pigeon_channel.setMessageHandler(null);
    } else {
      __pigeon_channel.setMessageHandler((Object? message) async {
        try {
          await api.deletedMessages();
          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_rustore_push.RuStorePushCallbacks.error', 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_rustore_push.RuStorePushCallbacks.error was null.');
        final List<Object?> args = (message as List<Object?>?)!;
        final String? arg_error = (args[0] as String?);
        assert(arg_error != null,
            'Argument for dev.flutter.pigeon.flutter_rustore_push.RuStorePushCallbacks.error was null, expected non-null String.');
        try {
          await api.error(arg_error!);
          return wrapResponse(empty: true);
        } on PlatformException catch (e) {
          return wrapResponse(error: e);
        }          catch (e) {
          return wrapResponse(error: PlatformException(code: 'error', message: e.toString()));
        }
      });
    }
  }
}