screenshot icon indicating copy to clipboard operation
screenshot copied to clipboard

Unsupported operation: toImage is not supported on the Web

Open stoneLee81 opened this issue 3 years ago • 4 comments

There are some scenarios where html engine must be used. For example, in WeChat. Have you considered adding html2canvas to make screenshots support web?

stoneLee81 avatar Oct 16 '21 06:10 stoneLee81

I have the same problem, on some Android devices it works on some not? Very strange :-/

meeximum avatar Jan 18 '22 22:01 meeximum

I openede an issue in the flutter repo to propose support toImage on html renderer https://github.com/flutter/flutter/issues/102636

bw-flagship avatar Apr 27 '22 10:04 bw-flagship

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

karlreginaldo avatar Jan 09 '24 17:01 karlreginaldo

Ok but what to do if i need to use the html renderer????

TetrixGauss avatar May 21 '24 10:05 TetrixGauss