text property

String get text

Implementation

String get text {
  if (bytes.length >= 2 && bytes[0] == 0xFE && bytes[1] == 0xFF) {
    final StringBuffer buffer = StringBuffer();
    for (int i = 2; i + 1 < bytes.length; i += 2) {
      buffer.writeCharCode((bytes[i] << 8) | bytes[i + 1]);
    }
    return buffer.toString();
  }
  if (bytes.length >= 3 && bytes[0] == 0xEF && bytes[1] == 0xBB && bytes[2] == 0xBF) return utf8.decode(Uint8List.sublistView(bytes, 3), allowMalformed: true);
  final StringBuffer buffer = StringBuffer();
  for (final int byte in bytes) {
    buffer.write(_pdfDocEncoding(byte));
  }
  return buffer.toString();
}