toByteData method Null safety

Future<ByteData?> toByteData(
  1. {ImageByteFormat format = ImageByteFormat.rawRgba}
)

Converts the Image object into a byte array.

The format argument specifies the format in which the bytes will be returned.

Returns a future that completes with the binary image data or an error if encoding fails.

Implementation

Future<ByteData?> toByteData({ImageByteFormat format = ImageByteFormat.rawRgba}) {
  assert(!_disposed && !_image._disposed);
  return _image.toByteData(format: format);
}