textGet method

String? textGet()

Returns the text content for the first (non-null) element in the selection.

selection.textGet(); // "Hello, world!"

This is generally useful only if you know the selection contains exactly one element.

Implementation

String? textGet() {
  var node = this.node();
  return node?.textContent;
}