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);
}
Comments are closed.