Semgrep Dart patterns add typed metavariables and function-definition matching
Introduced 2026-05-27 · score 0.97
HOW TO USE IT
When writing Dart rules in Semgrep 1.164.0, use the release’s new typed metavariable, `metavariable-type`, interpolation binding, and function-definition matching support. Scan the target with your rule file using `semgrep scan --config <rule.yaml> <target>`.
semgrep scan --config <rule.yaml> <target>WHY THIS HELPS
Write or update Semgrep rules that match Dart code using typed metavariables, string interpolations, or function definitions.
REQUIREMENTS AND LIMITATIONS
- Version: 1.164.0
- `metavariable-type.metavariable` (required): Metavariable to match.
- `metavariable-type.type`: Type expression. Use either `type` or `types`; the schema requires one of them.
- `metavariable-type.types`: Array of type expressions. Use either `types` or `type`; the schema requires one of them.
- `metavariable-type.language`: Language field in the `metavariable-type` object; its purpose is not described in the schema.
- `$X as T`: Dart typed metavariable syntax; the release note names it but the documentation found does not define its matching behavior.
FIRST-PARTY EVIDENCE
- https://github.com/semgrep/semgrep/releases/tag/v1.164.0
- https://semgrep.dev/docs/semgrep-ci/sample-ci-configs
- https://github.com/semgrep/semgrep-interfaces/blob/main/rule_schema_v1.yaml
Check the installed version and the source before using it. Entry JSON