Skip to content

Runtime detection for html versus canvaskit renderer #106689

Closed

Description

@jonahwilliams

There are a number of optimizations we'd like to make to the framework that will only work with the canvaskit renderer. For now, we can turn these off with kIsWeb, but ideally we could runtime detect canvaskit and apply those optimizations there as well.

Specifically:

  • Removal of opacity compositing
  • Route transitions with toGpuImage

@yjbanov

Activity

  1. added
    c: performanceRelates to speed or footprint issues (see "perf:" labels)
    platform-webWeb applications specifically
    P2Important issues not at the top of the work list
    on Jun 27, 2022
  2. yjbanov commented on Jun 28, 2022

    @yjbanov
    Contributor

    We also need this to unskip tests that can run in one of the renderers. Currently we skip tests for both renderers.

  3. added
    engineflutter/engine related. See also e: labels.
    on Jun 28, 2022
  4. dnfield commented on Jun 28, 2022

    @dnfield
    Contributor

    Would it make sense to have some kind of define like kAccelleratedGraphics?

    Renderer Value
    Software false
    GL true
    Metal true
    Vulkan true
    WebGL/GPU true
    HTML false
  5. jonahwilliams commented on Jun 28, 2022

    @jonahwilliams
    ContributorAuthor

    we'd still need to determine the difference between HTML and software, because some APIs just won't work in html

  6. jonahwilliams commented on Jun 28, 2022

    @jonahwilliams
    ContributorAuthor

    I mean I can implement this today as:

    final bool isHtmlRenderer = () {
      try {
        ui.SceneBuilder().build().toGpuImage(1, 1);
       } catch {
         return false;
       }
       return true;
    }();
    
    

    But ideally we'd have something less hacky

  7. dnfield commented on Jun 28, 2022

    @dnfield
    Contributor

    This feels like we're trying to work around the lack of an API availability language feature...

  8. jonahwilliams commented on Jun 28, 2022

    @jonahwilliams
    ContributorAuthor

    yes :)

  9. nshahan commented on Feb 13, 2026

    @nshahan
    Contributor

    @mdebbar
    Is this issue still relevant?

  10. mdebbar commented on Feb 13, 2026

    @mdebbar
    Contributor

    We've had runtime detection for quite a while now:

    /// Returns true if the application is using CanvasKit.
    ///
    /// Only to be used for web.
    bool get isCanvasKit => capabilities.isCanvasKit;
    /// Returns true if the application is using Skwasm.
    ///
    /// Only to be used for web.
    bool get isSkwasm => capabilities.isSkwasm;
    /// Returns true if the application is using CanvasKit or Skwasm.
    ///
    /// Only to be used for web.
    bool get isSkiaWeb => isCanvasKit || isSkwasm;

  11. github-actions commented on Feb 27, 2026

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  12. locked as resolved and limited conversation to collaborators on Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listc: performanceRelates to speed or footprint issues (see "perf:" labels)dependency: dartDart team may need to help usengineflutter/engine related. See also e: labels.platform-webWeb applications specificallyteam-webOwned by Web platform teamtriaged-webTriaged by Web platform team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions