2

My Flutter Web app loads very slowly. When checking the network section of DevTools I see that this is caused by the massive canvaskit.wasm file. I assume this is because Flutter is using the canvaskit web renderer instead of the html web renderer. How can I change this behaviour?

I have already tried building with

flutter build web --web-renderer html

but it has no effect.

As suggested by Flutter here, I have also tried overriding the renderer at runtime by inserting

<script>
    window.flutterWebRenderer = "html";
</script>

above <script src="main.dart.js".... But, this also has no effect. canvaskit.wasm still tries to load and brings everything to a grinding halt.

What else can I do? Is it even possible to prevent Flutter from requesting CanvasKit files?

(Note: I delete all the cache and app data from the browser between tests to ensure I'm not just loading the previous build)

PatrickMahomes
  • 844
  • 1
  • 6
  • 8

0 Answers0