SachinGanesh / screenshot

Flutter Screenshot Library
https://pub.dev/packages/screenshot
MIT License
343 stars 141 forks source link

Web:Unsupported operation: toImage is not supported on the Web #63

Open Patrick386 opened 3 years ago

Patrick386 commented 3 years ago

Flutter Web: flutter 2.2.3, Dart 2.13.4

I tested it with the sample source. Do you support the web?

NickKoroloff commented 3 years ago

I tested it in my web app, and it's working fine!

roberteverman commented 3 years ago

I tested it in my web app, and it's working fine!

I've found that it only works if you are using the CanvasKit renderer. If you try to use the HTML renderer it does not work.

c26ranto commented 3 years ago

I tested it in my web app, and it's working fine!

I've found that it only works if you are using the CanvasKit renderer. If you try to use the HTML renderer it does not work.

Yes, it works with CanvasKit renderer, just use this syntax bellow for compiling : flutter build web --web-renderer canvaskit you can close this issue.

hyungtaecf commented 3 years ago

I don't think it should close the issue, because some people like me need to use HTML renderer in the app in order for other things to work properly.

denyocrworld commented 2 years ago

image remove --web-renderer=html

its fixed for me

bw-flagship commented 2 years ago

I suppose this can be closed in favor of #82

SittiphanSittisak commented 2 years ago

In the HTML render, Have any function using instead toImage()? I need to use toImage() or some function can do like this. I have many issues when I am using the canvaskit renderer. Please fix it or create a new function for the HTML render.

karlreginaldo commented 8 months ago

So, I've had this problem for a while, and my co-worker solved it.

Go to web/index.html

Then, find the ### onEntrypointLoaded

Change it to this:

onEntrypointLoaded: async (engineInitializer) => {
const config = { renderer: "canvaskit" };
const appRunner = await engineInitializer.initializeEngine(config);
await appRunner.runApp();
}

The reason it works on PC/laptop is that it's set to canvaskit by default, but on the phone, it's not because it's set to auto. The reference is below.

https://docs.flutter.dev/platform-integration/web/renderers image