write method

void write(
  1. List<int> data, {
  2. String? description,
})

Writes data to this bytes instance.

Implementation

void write(List<int> data, {String? description}) {
  if (data.isEmpty) {
    return;
  }

  if (description != null) {
    _data.add(BytesEmitter(data: data, description: description));
    return;
  }

  if (data.length == 1) {
    _data.add(data[0]);
  } else {
    _data.add(data.asUint8List);
  }
}