prependVarint static method
Prepends a variable-length integer encoding of the given data length to the provided data.
data
The list of bytes representing the data.
Returns a new list of bytes with the variable-length integer encoding prepended to the data.
Implementation
static List<int> prependVarint(List<int> data) {
final varintBytes = encodeVarint(data.length);
return [...varintBytes, ...data];
}