contentLength static method

Uint8List contentLength({
  1. required int size,
})

Implementation

static Uint8List contentLength({required int size}) {
  if (size >= 128) {
    var lenBytes = Uint8List(size);
    while (lenBytes.first == 0) {
      lenBytes.removeAt(0);
    }
    int len = 0x80 | lenBytes.length;
    return Uint8List(len)..addAll(lenBytes);
  } else {
    return Uint8List(size);
  }
}