text property

String? get text

the text in this part builder

Implementation

String? get text => _text;
set text (String? value)

Implementation

set text(String? value) {
  if (value == null) {
    _text = value;
  } else {
    // replace single LF characters with CR LF in text: (sigh, SMTP)
    final runes = value.runes.toList(growable: false);
    List<int>? copy;
    var foundBareLineFeeds = 0;
    var lastChar = 0;
    for (var i = 0; i < runes.length; i++) {
      final char = runes[i];
      if (char == AsciiRunes.runeLineFeed &&
          (i == 0 || lastChar != AsciiRunes.runeCarriageReturn)) {
        // this is a single LF character
        copy ??= [...runes];
        copy.insert(i + foundBareLineFeeds, AsciiRunes.runeCarriageReturn);
        foundBareLineFeeds++;
      }
      lastChar = char;
    }
    _text = copy == null ? value : String.fromCharCodes(copy);
  }
}