renderer_switcher 0.1.0 icon indicating copy to clipboard operation
renderer_switcher: ^0.1.0 copied to clipboard

Platformweb

Switch flutter web renderers at runtime

renderer_switcher #

Swap Web Renderers in a Flutter Web app at runtime.

Installation #

To use this plugin, add renderer_switcher as a dependency in your pubspec.yaml file.

Then, add this script to the top of the body in your web/index.html file.

  <script type="text/javascript">
    window.flutterWebRenderer = localStorage.getItem('flutterWebRenderer');
  </script>

Usage #

// Returns WebRenderer.html, WebRenderer.canvaskit or WebRenderer.auto
final currentRenderer = await RendererSwitcher.getCurrentWebRenderer();

if(currentRenderer == WebRenderer.canvaskit){
    // Switches web renderer to canvaskit and reloads the window.
    RendererSwitcher.switchWebRenderer(WebRenderer.auto);
}
1
likes
120
pub points
82%
popularity

Publisher

unverified uploader

Switch flutter web renderers at runtime

Homepage

Documentation

API reference

License

Icon for licenses.MIT (LICENSE)

Dependencies

flutter, flutter_web_plugins, js

More

Packages that depend on renderer_switcher