write static method
Write variable integer to byte list
Implementation
static void write(List<int> bytes, int value) {
if (value < 0xFD) {
bytes.add(value);
} else if (value <= 0xFFFF) {
bytes.add(0xFD);
bytes.add(value & 0xFF);
bytes.add((value >> 8) & 0xFF);
} else if (value <= 0xFFFFFFFF) {
bytes.add(0xFE);
bytes.add(value & 0xFF);
bytes.add((value >> 8) & 0xFF);
bytes.add((value >> 16) & 0xFF);
bytes.add((value >> 24) & 0xFF);
} else {
throw WireException('Value too large for varint: $value');
}
}