Skip to content

[BUG] Build broken by html 0.15.7: Method not found: 'matches' in styled_element.dartError #1522

Description

@Arashecash

Title: Build broken by html 0.15.7: Method not found: 'matches' in styled_element.dart


Describe the bug:

flutter_html 3.0.0 fails to compile against html 0.15.7 (published 2026-08-28).

styled_element.dart imports package:html's private implementation file and calls its top-level matches():

// ignore: implementation_imports
import 'package:html/src/query_selector.dart' as qs;
...
return qs.matches(element, selector);   // line 31

html 0.15.7 removed that top-level matches() function from lib/src/query_selector.dart. Only the SelectorEvaluator.matches method remains, and SelectorEvaluator is not exported publicly either. Because the symbol was private, the removal is not listed as breaking in the html changelog.

flutter_html declares html: ^0.15.5, which admits 0.15.7, so every fresh dependency resolve since 28 August breaks the build. Projects that do not commit pubspec.lock hit this with no change of their own.

HTML to reproduce the issue: n/a - this is a compile-time failure. No HTML or widget is reached.

Html widget configuration: n/a - the app fails to build before any widget is constructed. Reproduce with any project that depends on flutter_html:

flutter pub upgrade html   # resolves to 0.15.7
flutter test               # or flutter build

Expected behavior:

flutter_html 3.0.0 builds against the versions its own constraint allows.

Device details and Flutter/Dart/flutter_html versions:

  • flutter_html 3.0.0
  • html 0.15.7 (fails) / 0.15.6 (works)
  • Flutter 3.38.3 stable, Dart 3.10.1
  • macOS - platform independent, it is a compile error

Stacktrace/Logcat

../../../.pub-cache/hosted/pub.dev/flutter_html-3.0.0/lib/src/tree/styled_element.dart:31:17:
Error: Method not found: 'matches'.
      return qs.matches(element, selector);
                ^^^^^^^

Additional info:

Workaround for users: pin the transitive dependency.

dependencies:
  html: 0.15.6

Possible fixes, in case they help:

  1. Tighten the constraint to html: '>=0.15.5 <0.15.7' as an immediate unblock.
  2. Replace the implementation import with a local selector-match helper, so flutter_html no longer depends on html's private API.
  3. Ask the html package to expose matches() publicly - there is currently no public equivalent (Node.querySelector / querySelectorAll exist, but nothing answers "does this element match this selector").

Activity

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

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions