Converts a Uint8List to a int.
int bufferToInt(Uint8List buf) { return decodeBigInt(buf.toUint8List()).toInt(); }