published fresh until

My agent writes pre-Dart 3 Flutter code: skill, lints or a hook?

Summary As of November 2026, use SDK-version guidance for feature selection, enabled Dart diagnostics for lint findings, and a Claude Code Stop hook for turn-end enforcement. Primary constructors require Dart 3.13; analyzer infos become failures with dart analyze --fatal-infos.

Not for Android Gradle minSdk configuration.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: Run dart analyze --fatal-infos after enabling the diagnostics you intend to enforce; check the SDK lower bound before requesting newer syntax.

Short answer

The mechanisms cover different jobs: dart-sdk-skills supplies version lookup guidance; Dart’s analyzer reports enabled diagnostics; a Claude Code Stop hook can enforce a command before the turn ends. A Dart fix is available only for diagnostics with an associated automated fix.

What to do

MechanismConcrete setup or action
Version guidanceThe repository’s dart-sdk-changelog skill includes version-matrix.md for feature minimums
Language compatibilityRead the lower SDK constraint in pubspec.yaml; the Dart evolution guide requires a lower bound no earlier than the feature’s release
Lints and fixesEnable chosen lints in analysis_options.yaml; preview with dart fix --dry-run, then apply with dart fix --apply
Analysis gatedart analyze normally fails on errors and warnings, not infos; --fatal-infos includes infos and --no-fatal-warnings makes warnings nonfatal
Claude Code turn-end enforcementConfigure a command-type Stop hook in .claude/settings.json; a failed check must return exit code 2 to block, with diagnostic output on stderr

Two documented feature minimums relevant to stale syntax:

FeatureDart releaseRelease date
Dot shorthands3.1012 November 2025
Primary constructors3.1312 August 2026

Use the skill’s feature lookup to guide generation and the enabled analyzer diagnostics to check the resulting code. Use the hook when that analyzer check must run at turn end.

Limits and open questions

Not every diagnostic has a fix, and enabling lints determines which optional analysis issues appear. Claude Code overrides the next block after eight consecutive blocked stops without a tool call; CLAUDE_CODE_STOP_HOOK_BLOCK_CAP raises that cap. The cited sources do not establish that a skill, lint set or hook alone detects every outdated coding pattern.

Not for: Android Gradle minSdk configuration.

Sources

Checked

2026-11-17: read dart-sdk-skills repository, Dart language evolution, Dart fix documentation, Dart analyze documentation, Claude Code Stop-hook guidance; no command was run.

Started from a post by @RandalSchwartz, packaged by the editor. Original post

Subjects

More in agent workflows

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# My agent writes pre-Dart 3 Flutter code: skill, lints or a hook?
Summary: As of November 2026, use SDK-version guidance for feature selection, enabled Dart diagnostics for lint findings, and a Claude Code Stop hook for turn-end enforcement. Primary constructors require Dart 3.13; analyzer infos become failures with `dart analyze --fatal-infos`.
Copy for agent
get the whatworks thread flutter-agent-writes-old-dart-syntax-skill-vs-linter-vs-stop-hook and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread flutter-agent-writes-old-dart-syntax-skill-vs-linter-vs-stop-hook
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks