write method
Implementation
void write(String chunk) {
_queue.unrefConsumedBlocks();
var data = chunk;
if (_pendingHighSurrogate case final pendingHighSurrogate?) {
data = '${String.fromCharCode(pendingHighSurrogate)}$data';
_pendingHighSurrogate = null;
}
if (data.isNotEmpty) {
final lastCodeUnit = data.codeUnitAt(data.length - 1);
if (_isHighSurrogate(lastCodeUnit)) {
_pendingHighSurrogate = lastCodeUnit;
data = data.substring(0, data.length - 1);
}
}
_queue.add(data);
_process();
_queue.unrefConsumedBlocks();
}