flutter

A set of Flutter rules for building cross-platform mobile interfaces with Dart, covering widgets, state, project structure, navigation, asynchronous work, errors, and themes.

In plain words
What is it for?
Use it when creating or reviewing Flutter widgets, organizing models and screens, selecting Provider, Bloc, or Riverpod, adding navigation, handling async operations, and maintaining shared visual styles.
Why use it?
It helps keep Flutter code organized and makes choices such as stateless versus stateful widgets and application-wide state management more consistent.

Cursor rule for Cursor

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.

agentmods
npx agentmods add rules/wangtingyeye/llm-agent-study/flutter
Clone the repo
git clone --depth 1 https://github.com/WangTingYeYe/llm-agent-study

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 282 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00000 $0.00282
Opus 5 $0.00000 $0.00141
Sonnet 5 $0.00000 $0.00056
Haiku 4.5 $0.00000 $0.00028

Measured yesterday against content hash 10782c58c8bc, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

flutter 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 yesterday.

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.

.cursor/rules/frameworks/flutter.mdc · 46 lines

What it actually says


description: 该规则解释了 Flutter 小部件模式和跨平台移动开发的最佳实践。 globs: **/*.dart alwaysApply: false

Flutter 规则

  • 对于没有内部状态的 UI 组件使用 StatelessWidget。
  • 对于需要维护状态的组件使用 StatefulWidget:
class Counter extends StatefulWidget {
  @override
  _CounterState createState() => _CounterState();
}

class _CounterState extends State<Counter> {
  int _count = 0;
  
  void _increment() {
    setState(() { _count++; });
  }
  
  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        Text('Count: $_count'),
        ElevatedButton(onPressed: _increment, child: Text('Increment')),
      ],
    );
  }
}
  • 对于复杂应用使用状态管理解决方案(Provider、Bloc、Riverpod)。
  • 使用适当的文件夹结构组织代码(models、screens、widgets、services)。
  • 使用命名路由和 Navigator.pushNamed() 进行导航。
  • 使用 async/await 处理异步操作,并进行适当的错误处理。
  • 使用主题(themes)在整个应用中保持一致的样式。
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. yesterday First seen · 46 lines · 0 tokens per session scan A 10782c58c8bc

Subscribe to this mod's changes

flutter is a cursor rule published in the GitHub repository WangTingYeYe/llm-agent-study (4 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 282 tokens. 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-31.