forgetPackage function

bool forgetPackage(
  1. String text
)

Returns true if the provided text contains a reference to a package that should be excluded.

This checks for:

  • "package:js"
  • the forbidden MUST_AVOID_PACKAGE value
  • direct imports of the forbidden package

Used to prevent accidental inclusion of unsupported JS interop packages.

Implementation

bool forgetPackage(String text) {
  return text.contains("package:js")
    || text.contains(MUST_AVOID_PACKAGE)
    || text.contains("import '$MUST_AVOID_PACKAGE'");
}