Skip to content

Check for modern web libraries to determine if an app is a web app #9973

Open

Description

@kenzieschmoll

We currently check for the presence of dart:html in the connected app to determine whether it is a web application.

https://github.com/flutter/devtools/blob/master/packages/devtools_app_shared/lib/src/service/connected_app.dart#L88-L89

We should make this an OR check with a package:web or dart:js_interop library. Leaving the dart:html condition we allow us to still support apps using dart:html (e.g. g3).

Activity

  1. added
    P1
    on Aug 20, 2026
  2. kenzieschmoll commented on Aug 20, 2026

    @kenzieschmoll
    MemberAuthor

    @kevmoo is package:web/web.dart the best library to check for? Is this guaranteed to be present in a Dart web app like dart:html used to be?

  3. kevmoo commented on Aug 20, 2026

    @kevmoo
    Contributor

    See https://api.dart.dev/

    Image

    Everything rolls down to
    dart:js_interop and dart:js_interop_unsafe

    If you want to know if a library will only work with a "web" compiler (dart2js, dart2wasm) this is where to look.

    You can likely borrow some logic from https://github.com/dart-lang/pana/

  4. kevmoo commented on Aug 20, 2026

    @kevmoo
    Contributor

    To be super clear: pkg:web is our BIGGEST example of the general rule: it rolls down to dart:js_interop and/or dart:js_interop_unsafe. Better to check for THOSE directly (er, indirectly via import/export chains).

  5. hkarmoush commented on Oct 17, 2026

    @hkarmoush
    Contributor

    I'll take this — treating a connected app as web if it has dart:html or dart:js_interop / dart:js_interop_unsafe, so dart2wasm / package:web apps are detected without dropping g3 dart:html support.

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

    P1type-code-health

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions