A simple package who convert widgets to image types;


Types Supported:

  • Uint8List
  • ByteData
  • Image
  • Dart:ui Image

Getting started

  1. Add this to your package's pubspec.yaml file:
  widget_to_image: any
  1. Get the package using your IDE's GUI or via command line with
$ pub get
  1. Import the widgets_to_image.dart file in your app
import 'package:convert_widget_to_image/widget_to_image.dart';


  1. First wrap you widget in a RepaintBoundary() and give him a GobalKey()
    key: key,
    child: ElevatedButton(
    style: ElevatedButton.styleFrom(
    shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.circular(12))),
        onPressed: () {},
        child: Text('Simple Button'),
  1. Then pass the key to the WidgetToImage selecting the constructor of type that you want
final dartUiImage = await WidgetToImage.asDartUiImage(key);
final byte = await WidgetToImage.asByteData(key);
final uint = await WidgetToImage.asUint8List(key);
final image = await WidgetToImage.asImage(key);

Additional information

Feel free to do pull requests or ask for changes on issues(on gitHub). There is a simple example on the github.