copyFrom method

void copyFrom(
  1. Cell other
)

Copies the full cell payload from other into this instance.

This lets hot buffer paths update an existing slot without allocating a replacement Cell object first.

Implementation

void copyFrom(Cell other) {
  if (identical(this, other)) return;
  _releaseLink();
  _releasePooledContent();
  _style = other._style;
  _styleId = other._styleId;
  _link = other._link;
  _linkId = other._linkId;
  _width = other._width;
  _contentKind = other._contentKind;
  _contentValue = other._contentValue;
  drawable = other.drawable;
  if (_contentKind == _CellContentKind.complex) {
    _graphemePool.retain(_contentValue);
    _attachPooledContentFinalizerIfNeeded();
  }
  if (_linkId != 0) {
    _linkRegistry.retain(_linkId);
    _attachLinkFinalizerIfNeeded();
  }
}