toLazyPayload method

LazyMessagePayload toLazyPayload({
  1. Object? anchor,
})

Exposes this message as a lazy payload view without eager re-encoding.

Implementation

LazyMessagePayload toLazyPayload({Object? anchor}) {
  final retainedLazyPayload = _retainedLazyPayload;
  if (retainedLazyPayload != null) {
    return retainedLazyPayload.withAnchor(anchor ?? this);
  }
  if (_pptPayloadDecoded) {
    return LazyMessagePayload.materialized(
      transparentBinaryPayload: transparentBinaryPayload,
      encoding: _lazyPayloadEncoding,
      arguments: arguments,
      argumentsKeywords: argumentsKeywords,
      pptDecoded: true,
      e2eeProvider: e2eeProvider,
      e2eeRuntimeContext: e2eeRuntimeContext,
      anchor: anchor ?? this,
    );
  }
  if ((_encodedArguments != null && _argumentsDecoder != null) ||
      (_encodedArgumentsKeywords != null &&
          _argumentsKeywordsDecoder != null)) {
    return LazyMessagePayload.encoded(
      transparentBinaryPayload: transparentBinaryPayload,
      encoding: _lazyPayloadEncoding,
      argumentsBytes: _encodedArguments,
      argumentsKeywordsBytes: _encodedArgumentsKeywords,
      argumentsDecoder: _argumentsDecoder,
      argumentsKeywordsDecoder: _argumentsKeywordsDecoder,
      arguments: _encodedArguments == null ? _arguments : null,
      argumentsKeywords: _encodedArgumentsKeywords == null
          ? _argumentsKeywords
          : null,
      e2eeProvider: e2eeProvider,
      e2eeRuntimeContext: e2eeRuntimeContext,
      anchor: anchor ?? this,
    );
  }
  return LazyMessagePayload.materialized(
    transparentBinaryPayload: transparentBinaryPayload,
    encoding: _lazyPayloadEncoding,
    arguments: _arguments,
    argumentsKeywords: _argumentsKeywords,
    e2eeProvider: e2eeProvider,
    e2eeRuntimeContext: e2eeRuntimeContext,
    anchor: anchor ?? this,
  );
}