captureImage method

Future<Image?> captureImage()

The final image for avatar-style callers, as a handle the caller disposes. Unlike composedImage, this also yields an unedited source image so the avatar matches the preview instead of any raw file metadata quirks. Null for a video or an image that cannot be decoded.

Implementation

Future<ui.Image?> captureImage() async {
  if (input is! ImageMedia) return null;
  final image = await composedImage() ?? await ensureSource();
  if (disposed) return null;
  return image?.clone();
}