asByteData static method

Implementation

static Future<ByteData> asByteData(GlobalKey key) async {
  final WidgetToImageController controller = WidgetToImageController(key);
  var image = await controller.toByteData();

  if (image != null) {
    return image;
  } else {
    throw Exception('A error happens while converting');
  }
}