Source
factory BitmapData.fromImageElement(ImageElement imageElement, [num pixelRatio = 1.0]) { var renderTexture = new RenderTexture.fromImageElement(imageElement); var renderTextureQuad = renderTexture.quad.withPixelRatio(pixelRatio); return new BitmapData.fromRenderTextureQuad(renderTextureQuad); }