setup static method

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

Implementation

static void setup(SignalRPlatformApi? api,
    {BinaryMessenger? binaryMessenger}) {
  {
    final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
        'dev.flutter.pigeon.SignalRPlatformApi.onStatusChange', codec,
        binaryMessenger: binaryMessenger);
    if (api == null) {
      channel.setMessageHandler(null);
    } else {
      channel.setMessageHandler((Object? message) async {
        assert(message != null,
            'Argument for dev.flutter.pigeon.SignalRPlatformApi.onStatusChange was null.');
        final List<Object?> args = (message as List<Object?>?)!;
        final StatusChangeResult? arg_statusChangeResult =
            (args[0] as StatusChangeResult?);
        assert(arg_statusChangeResult != null,
            'Argument for dev.flutter.pigeon.SignalRPlatformApi.onStatusChange was null, expected non-null StatusChangeResult.');
        await api.onStatusChange(arg_statusChangeResult!);
        return;
      });
    }
  }
  {
    final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
        'dev.flutter.pigeon.SignalRPlatformApi.onNewMessage', codec,
        binaryMessenger: binaryMessenger);
    if (api == null) {
      channel.setMessageHandler(null);
    } else {
      channel.setMessageHandler((Object? message) async {
        assert(message != null,
            'Argument for dev.flutter.pigeon.SignalRPlatformApi.onNewMessage was null.');
        final List<Object?> args = (message as List<Object?>?)!;
        final String? arg_hubName = (args[0] as String?);
        assert(arg_hubName != null,
            'Argument for dev.flutter.pigeon.SignalRPlatformApi.onNewMessage was null, expected non-null String.');
        final String? arg_message = (args[1] as String?);
        assert(arg_message != null,
            'Argument for dev.flutter.pigeon.SignalRPlatformApi.onNewMessage was null, expected non-null String.');
        await api.onNewMessage(arg_hubName!, arg_message!);
        return;
      });
    }
  }
}