skip to Main Content

I’m thinking about using my flutter app as web app. and now flutter web is better than before right?. It could be ssr and there are two renderer…
and now i want to know how heavily does flutter web depend on dom of canvas. Html renderer even depeds on canvas so much?

HTML renderer
This renderer, which has a smaller download size than the CanvasKit renderer, uses a combination of HTML elements, CSS, Canvas elements, and SVG elements.
CanvasKit renderer
This renderer is fully consistent with Flutter mobile and desktop, has faster performance with higher widget density, but adds about 1.5MB in download size. CanvasKit uses WebGL to render Skia paint commands.
Document renderer

2

Answers


  1. Flutter web has indeed made significant improvements over time and is now more stable and capable than before. When it comes to rendering in Flutter web, there are two main options: the HTML renderer and the CanvasKit renderer. Let’s discuss them briefly:

    HTML Renderer:

    The HTML renderer uses a combination of HTML elements, CSS, Canvas elements, and SVG elements to render Flutter widgets in the browser.
    It generally has a smaller download size compared to the CanvasKit renderer.
    This renderer is suitable for most web applications and offers good performance and compatibility across different browsers.
    However, it may have limitations in terms of performance with very complex UIs or animations.
    CanvasKit Renderer:

    The CanvasKit renderer is fully consistent with Flutter mobile and desktop platforms, offering a more consistent experience across different platforms.
    It provides faster performance, especially with higher widget density, and is optimized for complex UIs and animations.
    The CanvasKit renderer uses WebGL to render Skia paint commands, which can lead to better performance but adds approximately 1.5MB to the download size of the application.
    This renderer is suitable for applications that require high-performance graphics and animations, such as games or complex visualizations.
    In terms of dependency on the DOM (Document Object Model), both renderers rely on the DOM to some extent, but the degree of dependency varies:

    The HTML renderer makes use of HTML elements and CSS to render Flutter widgets within the DOM structure of the webpage.
    The CanvasKit renderer also interacts with the DOM but primarily uses WebGL to render Skia paint commands directly onto the canvas element.
    Overall, Flutter web applications can be built using either renderer based on the specific requirements of the project. It’s important to consider factors such as performance, download size, and compatibility when choosing between the HTML renderer and the CanvasKit renderer. Additionally, Flutter web’s capabilities continue to evolve, so it’s worth keeping an eye on future updates and improvements to the platform.

    Login or Signup to reply.
  2. I want to give an overview that yes, flutter for web has made significant advancements, and Flutter web is indeed better than before. As of my last update, Flutter for web has become more stable, performant, and feature-rich. Let’s address your questions:

    1. Server-Side Rendering (SSR): Flutter for web does not inherently support server-side rendering (SSR) out of the box. However, you can use packages like flutter_ssr to achieve SSR with Flutter web. SSR with Flutter web can help improve initial page load times and SEO.

    2. Renderers: Flutter for web has two rendering modes: CanvasKit and HTML. Both rendering modes have their advantages and use cases.

      • CanvasKit Renderer: This renderer uses WebGL or Skia to draw directly to a canvas element. It provides consistent performance across browsers and is suitable for complex UIs and animations.

      • HTML Renderer: This renderer translates Flutter widgets into HTML, CSS, and DOM elements. It’s optimized for simpler UIs and works well for SEO and accessibility. However, it may not offer the same level of performance as the CanvasKit renderer for complex UIs and animations.

    3. Dependency on Canvas: Both rendering modes in Flutter for web have some dependency on the canvas element:

      • CanvasKit Renderer: This renderer directly renders to a canvas element using WebGL or Skia.

      • HTML Renderer: While this renderer ultimately produces HTML, CSS, and DOM elements, it may still use canvas behind the scenes for certain operations or effects, especially when dealing with complex UI elements or animations.

    Overall, Flutter for web has matured significantly, offering developers the flexibility to choose between rendering modes based on their specific requirements. Whether you prioritize performance, SEO, or complexity of UI, Flutter for web provides options to cater to various use cases.

    for more details info you can visit this LINK

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search