SachinGanesh / screenshot

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

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

Open Lalitchaudhary2 opened 3 years ago

paulagrisolia-tc commented 3 years ago

this plugin is not supported by flutter web version. please, change the documentation.

SanderBel commented 3 years ago

It is supported on Web. However only supported on canvaskit renderer and not html renderer. --web-renderer canvaskit hope this helps.

bw-flagship commented 2 years ago

I suppose this can be closed in favor if #82

karlreginaldo commented 10 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