# Dart use pattern matching

> Dart use pattern matching is an open-source agent skill. Applies Dart 3 pattern matching, switch expressions, and destructuring idiomatically to validate data schemas, handle algebraic data types,. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/flutter/agent-plugins/tree/main/skills/dart-use-pattern-matching
- **Repository:** https://github.com/flutter/agent-plugins
- **GitHub stars:** 3,186
- **License:** BSD-3-Clause
- **Skill name:** dart-use-pattern-matching
- **Collection:** https://github.com/flutter/agent-plugins
- **Listing updated:** 2026-11-17

## About

Applies Dart 3 pattern matching, switch expressions, and destructuring idiomatically to validate data schemas, handle algebraic data types, and decompose control flow. Use when refactoring complex if-else chains, parsing polymorphic JSON or API responses, destructuring Lists, URI/path segments, String.split() tokens, Records, or Maps, or enforcing exhaustiveness on sealed classes. Don't use for simple boolean conditions, single-variable type promotion (use `is`), or basic collection filtering.

## When your agent uses it

> Applies Dart 3 pattern matching, switch expressions, and destructuring idiomatically to validate data schemas, handle algebraic data types, and decompose control flow. Use when refactoring complex if-else chains, parsing polymorphic JSON or API responses, destructuring Lists, URI/path segments, String.split() tokens, Records, or Maps, or enforcing exhaustiveness on sealed classes. Don't use for simple boolean conditions, single-variable type promotion (use `is`), or basic collection filtering.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/flutter/agent-plugins/tree/HEAD/skills/dart-use-pattern-matching)
- [License: BSD-3-Clause](https://github.com/flutter/agent-plugins/tree/HEAD/skills/dart-use-pattern-matching)

## Install

### Claude Code

This skill ships in the `dart-flutter` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add flutter/agent-plugins
/plugin install dart-flutter@dart-flutter
```

Or copy only this skill to `~/.claude/skills/dart-use-pattern-matching`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/flutter/agent-plugins.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/dart-use-pattern-matching &&
cp -R "$tmp/skills/dart-use-pattern-matching" ~/.claude/skills/dart-use-pattern-matching &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/dart-use-pattern-matching` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/dart-use-pattern-matching` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/flutter/agent-plugins.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/dart-use-pattern-matching &&
cp -R "$tmp/skills/dart-use-pattern-matching" ~/.agents/skills/dart-use-pattern-matching &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/dart-use-pattern-matching` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/dart-use-pattern-matching` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/flutter/agent-plugins.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/dart-use-pattern-matching &&
cp -R "$tmp/skills/dart-use-pattern-matching" ~/.cursor/skills/dart-use-pattern-matching &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/dart-use-pattern-matching` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/flutter/agent-plugins.git --path skills/dart-use-pattern-matching
```

Or copy the folder to `~/.gemini/skills/dart-use-pattern-matching` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/dart-use-pattern-matching`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/flutter/agent-plugins.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/dart-use-pattern-matching &&
cp -R "$tmp/skills/dart-use-pattern-matching" ~/.copilot/skills/dart-use-pattern-matching &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/dart-use-pattern-matching` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/flutter/agent-plugins.git
```

Then copy `agent-plugins/skills/dart-use-pattern-matching` into your agent's skills folder as `dart-use-pattern-matching`. Agents that support SKILL.md read one folder per skill.

## FAQ

### How do I install Dart use pattern matching in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/dart-use-pattern-matching to use it in all your projects, or to .claude/skills/dart-use-pattern-matching in one project. Or install the dart-flutter plugin, which includes it: /plugin marketplace add flutter/agent-plugins, then /plugin install dart-flutter@dart-flutter.

### Does Dart use pattern matching run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Dart use pattern matching?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

---
Source: https://ai-powered.com/skills/dart-use-pattern-matching
