flutter-development

A set of working rules for building Flutter apps with Dart. It covers reusable screen components, app data handling, and connections to native phone features.

In plain words
What is it for?
Use it to create or update Flutter apps for mobile, web, or desktop, manage app state, add packages, and connect Dart code with platform-specific features.
Why use it?
It helps keep Flutter projects consistent and makes developers check the existing project, installed tools, and required versions before changing code.

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/madebyaris/rakitui-ai/flutter-development
Clone the repo
git clone --depth 1 https://github.com/madebyaris/rakitui-ai

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 4,398 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.04398
Opus 5 $0.00000 $0.02199
Sonnet 5 $0.00000 $0.00880
Haiku 4.5 $0.00000 $0.00440

Measured 2d ago against content hash 80fdead8b9ce, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

flutter-development 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 2d 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.

.cursor/rules/flutter-development.mdc · 891 lines

How it starts

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

Flutter Development Patterns

Modern Flutter patterns for cross-platform mobile, web, and desktop development.

CRITICAL: Agentic-First Flutter Development

Pre-Development Verification (MANDATORY)

Before writing ANY Flutter code:

1. CHECK FLUTTER INSTALLATION
   → run_terminal_cmd("flutter --version")
   → run_terminal_cmd("flutter doctor")
   
2. VERIFY CURRENT VERSIONS (use web_search)
   → web_search("Flutter stable version December 2024")
   → web_search("Dart SDK version December 2024")
   
3. CHECK EXISTING PROJECT
   → Does pubspec.yaml exist? Read it first!
   → What Flutter/Dart SDK is specified?
   → Are dependencies already installed?
   
4. FOR NEW PROJECTS - USE flutter create
   → NEVER manually create pubspec.yaml from scratch
   → run_terminal_cmd("flutter create my_app")

CLI-First Flutter Development

ALWAYS use Flutter CLI:

# Project creation (NEVER manually create pubspec.yaml)
flutter create my_app
flutter create --org com.example my_app
flutter create --template package my_package

# Add dependencies (NEVER manually edit pubspec.yaml for adding)
flutter pub add provider
flutter pub add go_router
flutter pub add flutter_bloc
flutter pub add dio
flutter pub add freezed --dev
flutter pub add build_runner --dev

# Get dependencies (ALWAYS after any pubspec change)
flutter pub get

# Code generation (for freezed, json_serializable)
dart run build_runner build --delete-conflicting-outputs

# Verify project health
flutter analyze
flutter test

Post-Edit Verification

After ANY Flutter code changes, ALWAYS run:

# Get dependencies
flutter pub get

# Analyze for issues
flutter analyze

# Run tests
flutter test

# Check formatting
dart format --set-exit-if-changed .

Common Dart/Flutter Syntax Traps (Avoid These!)

// WRONG: Missing const for immutable widgets
Widget build(BuildContext context) {
  return Container(  // Should be const Container()
    child: Text('Hello'),
  );
}

// CORRECT: Use const where possible
Widget build(BuildContext context) {
  return const Container(
    child: Text('Hello'),
  );
}

// WRONG: Not disposing controllers
class _MyWidgetState extends State<MyWidget> {
  final controller = TextEditingController();
  // Missing dispose!
}

// CORRECT: Always dispose controllers
class _MyWidgetState extends State<MyWidget> {
  final controller = TextEditingController();
  
  @override
  void dispose() {
    controller.dispose();
    super.dispose();
  }
}

// WRONG: Using setState after dispose
void _onDataLoaded(data) async {
  await fetchMore();
  setState(() {  // Might be called after dispose!
    this.data = data;
  });
}

// CORRECT: Check mounted before setState
void _onDataLoaded(data) async {
  await fetchMore();
  if (mounted) {
    setState(() {
      this.data = data;
    });
  }
}

// WRONG: Missing required in named parameters (Dart 3+)
void greet({String name}) { }  // Error in null-safe Dart

// CORRECT: Use required for non-nullable required params
void greet({required String name}) { }

Read the full file on GitHub · 891 lines

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. 2d ago First seen · 891 lines · 0 tokens per session scan A 80fdead8b9ce

Subscribe to this mod's changes

flutter-development is a cursor rule published in the GitHub repository madebyaris/rakitui-ai (5 stars, last pushed 7mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 4,398 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.