decode method
Decode the bytes into an img.Image using the appropriate decoder
Implementation
img.Image? decode(List<int> bytes) {
img.Decoder? decoder;
switch (_type) {
case 'viamRgba':
decoder = _ViamRGBADecoder();
break;
case 'jpeg':
decoder = img.JpegDecoder();
break;
case 'png':
decoder = img.PngDecoder();
break;
case 'pcd':
decoder = null;
break;
case 'unsupported':
decoder = null;
break;
}
if (decoder == null) {
return null;
}
return decoder.decode(Uint8List.fromList(bytes));
}