decodeScaleAsInteger method
Decodes a SCALE-encoded compact integer at offset as a Dart int.
Implementation
LayoutDecodeResult<int> decodeScaleAsInteger(int offset) {
final decode = LayoutSerializationUtils.decodeScale(_bytes, offset: offset);
if (!decode.value.isSafeInt()) {
throw const BuError(
DefaultErrorType.invalidLength,
"scale number is too large for int.",
);
}
return LayoutDecodeResult(
consumed: decode.consumed,
value: decode.value.toInt(),
);
}