copyPayloadTo method

void copyPayloadTo(
  1. AbstractMessageWithPayload message
)

Transfers the message payload to another message

Implementation

void copyPayloadTo(AbstractMessageWithPayload message) {
  message.attachE2eeProvider(e2eeProvider);
  message.attachE2eeRuntimeContext(e2eeRuntimeContext);
  message.transparentBinaryPayload = transparentBinaryPayload;

  if ((_encodedArguments != null && _argumentsDecoder != null) ||
      (_encodedArgumentsKeywords != null &&
          _argumentsKeywordsDecoder != null)) {
    message.setLazyPayload(
      argumentsBytes: _encodedArguments == null
          ? null
          : Uint8List.fromList(_encodedArguments!),
      argumentsDecoder: _argumentsDecoder,
      argumentsKeywordsBytes: _encodedArgumentsKeywords == null
          ? null
          : Uint8List.fromList(_encodedArgumentsKeywords!),
      argumentsKeywordsDecoder: _argumentsKeywordsDecoder,
      encoding: _lazyPayloadEncoding,
    );
    if (_encodedArguments == null) {
      message.arguments = _arguments == null
          ? null
          : List<dynamic>.from(_arguments!);
    }
    if (_encodedArgumentsKeywords == null) {
      message.argumentsKeywords = _argumentsKeywords == null
          ? null
          : Map<String, dynamic>.from(_argumentsKeywords!);
    }
    message._pptPayloadDecoded = _pptPayloadDecoded;
  } else {
    message._lazyPayloadEncoding = _lazyPayloadEncoding;
    message.arguments = _arguments == null
        ? null
        : List<dynamic>.from(_arguments!);
    message.argumentsKeywords = _argumentsKeywords == null
        ? null
        : Map<String, dynamic>.from(_argumentsKeywords!);
    message._pptPayloadDecoded = _pptPayloadDecoded;
  }
  final retainedLazyPayload = _retainedLazyPayload;
  if (retainedLazyPayload != null) {
    message.retainLazyPayload(retainedLazyPayload.toOwned());
  }
}