encodeVarint static method
Encodes a varint
Implementation
static Uint8List encodeVarint(int value) {
if (value < 0) throw ArgumentError('Negative varint not allowed');
final bytes = <int>[];
while (value >= 0x80) {
bytes.add((value & 0x7F) | 0x80);
value >>= 7;
}
bytes.add(value & 0x7F);
return Uint8List.fromList(bytes);
}