dart-use-pattern-matching

dart-use-pattern-matching is a skill for Claude Code from flutter/agent-plugins. It costs 106 tokens per session (3,259 once invoked), scanned A, original, BSD-3-Clause.

A Dart coding guide for choosing switch expressions and pattern matching, a way to check data shapes and pull out their values in one step.

In plain words
What is it for?
Use it when processing JSON maps and lists, unpacking records, handling sealed-class variants, matching ranges, or sharing logic across cases.
Why use it?
It helps make code that handles different data forms, types, ranges, and cases easier to structure and verify.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: positional $N argument.

Part of the dart-flutter plugin — 31 skills shipped together

Good fit Use it when processing JSON maps and lists, unpacking records, handling sealed-class variants, matching ranges, or sharing logic across cases.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/flutter/agent-plugins/dart-use-pattern-matching
About the project

Flutter Agent Plugins is a collection maintained by the Flutter team that extends coding agents with Flutter-specific skills, rules, MCP configuration, and bundled workflows. Flutter developers use it to help agents perform tasks such as testing and building widget previews. The catalogue entries are components of these agent plugins.

flutter/agent-plugins · 3,222 stars · on GitHub

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add flutter/agent-plugins --skill dart-use-pattern-matching
Clone the repo
git clone --depth 1 https://github.com/flutter/agent-plugins

Made for: Claude Code.

Or install dart-flutter, the plugin that ships this one along with the rest of its 31 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for dart-use-pattern-matching

README.md
[![agentmods](https://agentmods.dev/badge/skills/flutter/agent-plugins/dart-use-pattern-matching/github.svg)](https://agentmods.dev/skills/flutter/agent-plugins/dart-use-pattern-matching)
Your own site
<a href="https://agentmods.dev/skills/flutter/agent-plugins/dart-use-pattern-matching"><img src="https://agentmods.dev/badge/skills/flutter/agent-plugins/dart-use-pattern-matching/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for dart-use-pattern-matching

Your own site · 80×15
<a href="https://agentmods.dev/skills/flutter/agent-plugins/dart-use-pattern-matching"><img src="https://agentmods.dev/badge/skills/flutter/agent-plugins/dart-use-pattern-matching.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 106 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,259 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • Socket pass 20 Oct 2026
  • Snyk pass 20 Oct 2026
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00106 $0.03259
Opus 5.5 $0.00042 $0.01304
Sonnet 5.5 $0.00021 $0.00652
Haiku 4.5 $0.00011 $0.00326

Measured 1mo ago against content hash 503d31e7bc08, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

dart-use-pattern-matching scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

2 near-identical copies found in the catalogue:

skills/dart-use-pattern-matching/SKILL.md · 273 lines

How it starts

The opening of the file, as written. The whole thing — 273 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Implementing Dart Patterns

Contents

Pattern Selection Strategy

Apply specific pattern types based on the data structure and desired outcome. Follow these conditional guidelines:

  • If validating and extracting from deserialized data (e.g., JSON): Use Map, List, and Object patterns to validate schema structure and destructure properties in a single step.
  • If inspecting URL/path segments (uri.pathSegments, p.split(path)) or String.split() tokens: Use List patterns with rest elements (['api', 'comments', ...], ['assets', ...final rest], [..., final parent, _]) instead of manual .length checks, .first, .skip(1), or length - N index arithmetic.
  • If handling polymorphic payloads or responses: Use switch expressions over map discriminant keys to deserialize into sealed class hierarchies.
  • If handling multiple return values: Use Record patterns to destructure fields directly into local variables.
  • If unpacking multiple fields from an object or MapEntry: Use Object patterns (final Spec(:field1, :field2!) = spec;, for (final MapEntry(:key, :value) in map.entries)) when promoting nullable properties or unpacking 3+ fields used across multiple statements, rather than for single-call passthroughs.
  • If executing type-specific behavior (Algebraic Data Types): Use Object patterns combined with sealed classes to ensure exhaustiveness.
  • If matching numeric ranges or conditions: Use Relational (>=, <=) and Logical-and (&&) patterns within switch arms.
  • If multiple cases share logic: Use Logical-or (||) patterns to share a single case body or guard clause.
  • If ignoring specific values: Use the Wildcard pattern (_) or a non-matching Rest element (...) in collections.

Read the full file on GitHub · 273 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago Changed · +20 lines 503d31e7bc08
  2. 2mo ago Changed · +16 lines · +12 tokens per session 46d854da7d22
  3. 2mo ago Changed · +90 lines · +80 tokens per session 7a4d50dbb310
  4. 3mo ago First seen · 147 lines · 14 tokens per session scan A 39d71b585417

Subscribe to this mod's changes

dart-use-pattern-matching is a skill published in the GitHub repository flutter/agent-plugins (3,222 stars, last pushed 12d ago), licensed BSD-3-Clause. It adds 106 tokens to every session and 3,259 once invoked, about $0.0004 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

dart-use-pattern-matching compared with skills from other repositories

dart-use-pattern-matching next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
dart-use-pattern-matchingflutter/agent-pluginsSkill3.2k12d agoBSD-3-ClauseA106Claude Code
omh-rustrlaope/oh-my-hermesSkill6.2kyesterdayMITA19Claude Code
erlang-otp-behaviorsbenchflow-ai/skillsbenchSkill1.9k6d agoApache-2.0A52Claude Code, Codex
axiom-concurrencyCharlesWiltgen/AxiomSkill1.3k22d agoMITA49Claude Code
tddcodewithmukesh/dotnet-claude-kitSkill85326d agoMITA81Claude Code
haskell-prormyndharis/antigravity-skillsSkill2.1k23d agoMITA37Claude Code, Codex
compiler-optimizations-deepmohitmishra786/low-level-dev-skillsSkill30410d agoMITA74Claude Code, Codex