getRenderableImage method

  1. @override
RenderableImg? getRenderableImage({
  1. Size? size,
  2. ImageFileFormat format = ImageFileFormat.png,
  3. Color backgroundColor = Colors.transparent,
  4. bool allowResize = false,
})
override

Retrieves image with bytes and actual rendered dimensions.

Parameters

  • size - Optional desired dimensions (width/height in pixels). If omitted, uses SDK recommended size
  • format - Output format (default: ImageFileFormat.png)
  • backgroundColor - Background color (default: Colors.transparent)
  • allowResize - When true, SDK chooses optimal width based on height; when false, uses exact size (default: false)

Returns

  • RenderableImg containing bytes, width, and height, or null if invalid

See also:

Implementation

@override
RenderableImg? getRenderableImage({
  Size? size,
  ImageFileFormat format = ImageFileFormat.png,
  Color backgroundColor = Colors.transparent,
  bool allowResize = false,
}) {
  final Rgba bgColor = backgroundColor.toRgba();

  return GemKitPlatform.instance.callGetFlutterImg(
    pointerId,
    size != null ? size.width.toInt() : -1,
    size != null ? size.height.toInt() : -1,
    format.id,
    arg: jsonEncode(bgColor),
    allowResize: allowResize,
  );
}