getBytes method

Uint8List getBytes({
  1. ChannelOrder? order,
  2. num? alpha,
})

Similar to toUint8List, but will convert the channels of the image pixels to the given order. If that happens, the returned bytes will be a copy and not a direct view of the image data. If the number of channels needed by order differs from what the image has, the bytes will come from a converted image. If the converted image needs an alpha channel added, then you can use the alpha argument to specify the value of the added alpha channel.

Implementation

Uint8List getBytes({ChannelOrder? order, num? alpha}) {
  var self = this;
  if (order != null && channelOrderLength[order] != numChannels) {
    self = convert(numChannels: channelOrderLength[order], alpha: alpha);
  }
  return self.data?.getBytes(order: order, inPlace: self != this) ??
      toUint8List();
}