data property

String data

Implementation

String get data => _data;
void data=(String newData)

Implementation

set data(String newData) {
  String oldData = data;
  if (oldData == newData) return;

  _data = newData;

  // Empty string of textNode should not attach to render tree.
  if (oldData.isNotEmpty && newData.isEmpty) {
    _detachRenderTextBox();
  } else if (oldData.isEmpty && newData.isNotEmpty) {
    attachTo(parentElement!);
  } else {
    _applyTextStyle();

    // To replace data of node node with offset offset, count count, and data data, run step 12 from the spec:
    // 12. If node’s parent is non-null, then run the children changed steps for node’s parent.
    // https://dom.spec.whatwg.org/#concept-cd-replace
    parentNode?.childrenChanged();
  }
}