Skip to content

wilsonowilson/renderer_switcher

Repository files navigation

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);
}

About

Easily swap Flutter web renderers at runtime

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published