toImage method

Future<Image> toImage({
  1. double pixelRatio = 1.0,
})

Implementation

Future<Image> toImage({double pixelRatio = 1.0}) {
  if (layer == null) {
    Completer<Image> completer = Completer<Image>();
    SchedulerBinding.instance.scheduleFrameCallback((_) {
      completer.complete(toImage(pixelRatio: pixelRatio));
    });
    return completer.future;
  }
  assert(isRepaintBoundary);
  final OffsetLayer offsetLayer = layer as OffsetLayer;
  return offsetLayer.toImage(Offset.zero & size, pixelRatio: pixelRatio);
}