imageDecode method
Decodes encoded image bytes into a native image handle.
Implementation
({int status, TerminalImageHandle? handle}) imageDecode(Uint8List data) {
_checkUnsignedAbi(data.length, 0xFFFFFFFF, 'dataLength');
return _guardAlloc('Failed to decode image', (allocator) {
final bytes = _copyBytes(allocator, data);
final output = allocator<Uint32>()..value = 0;
final status = _native.imageDecode(bytes, data.length, output);
final value = output.value;
return (
status: status,
handle: value == 0 ? null : TerminalImageHandle.fromNative(value),
);
});
}