Skip to content
pubscout

widgets_to_image

2.0.1, released a year ago by mohamed-abdo.com

Convert any Flutter widget into high-quality images with customizable formats and settings.

WASM-ready
$ flutter pub add widgets_to_image
Source repository

What it does

Allows developers to wrap any Flutter widget and convert it into image byte formats like PNG, JPEG, or raw data using a controller. It supports custom pixel ratios, quality controls, animation waiting, and lifecycle callbacks.

AI-written summary of version 2.0.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to export a custom-built Flutter widget or UI component as an image file or bytes.
  • You are building features like receipt generators, social sharing cards, or dynamic badge creators within your app.

Skip it when

  • You only need to load and display static image assets or network images.
  • You are looking for a complete image picker or cropper tool.

Strengths

  • Supports multiple formats including PNG, JPEG, Raw RGBA, and Raw Unmodified.
  • Cross-platform support across Android, iOS, Web, macOS, Windows, and Linux.
  • Includes helpful utilities like `WidgetsToImageBuilder` and dedicated convenience methods.

Weaknesses

  • Limited to converting rendered widgets currently mounted in the widget tree.
  • Complex animations or off-screen rendering may require specific configuration delays.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
0
WidgetsToImageController controller = WidgetsToImageController();

WidgetsToImage(
  controller: controller,
  child: Container(child: Text('Hello World!')),
);

Uint8List? bytes = await controller.capture();

Alternatives

Packages that do the same job and could replace widgets_to_image.