assertByteArrayIsNotEmptyForCodec function
void
assertByteArrayIsNotEmptyForCodec(])
Asserts that the byte array is not empty after the optional offset.
Throws a SolanaError with code
SolanaErrorCode.codecsCannotDecodeEmptyByteArray if the byte array has
no bytes remaining after offset.
Implementation
void assertByteArrayIsNotEmptyForCodec(
String codecDescription,
Uint8List bytes, [
int offset = 0,
]) {
if (bytes.length - offset <= 0) {
throw SolanaError(SolanaErrorCode.codecsCannotDecodeEmptyByteArray, {
'codecDescription': codecDescription,
});
}
}