Flutter Cursor Rules Template
Generate production-ready Flutter Cursor rules for Project Rules (.mdc), AGENTS.md, or legacy .cursorrules. This template encodes stack-specific conventions for projects using Flutter. Dart-based UI toolkit with hot reload, Material Design, and native compilation.
The Complete Flutter Cursor Rules
The full rule set in all three formats Cursor understands — copy the one your project uses. Project Rules (.mdc) load per-file via globs, AGENTS.md is portable across AI tools, and .cursorrules is the legacy single-file format.
Replacing a legacy file? Read the guide to migrate .cursorrules to Cursor Project Rules (.mdc) before copying this template into your project.
---
description: "Widget Structure"
alwaysApply: false
---
- Use composition over inheritance — prefer StatelessWidget and StatefulWidget.
- Use spaces for indentation.
- Use camelCase for variables and methods.
- Extract reusable widgets into separate files.
- Use const constructors for compile-time constant widgets.
- Keep build methods clean — extract complex UI into helper methods.---
description: "State Management"
alwaysApply: false
---
- Use setState for simple local state within a single widget.
- Use Provider or Riverpod for dependency injection and state propagation.
- Use Bloc/Cubit for complex business logic with event-driven patterns.
- Keep business logic out of widgets — use controllers or blocs.
- Use ValueNotifier and ValueListenableBuilder for single-value state.
- Avoid rebuilding the entire widget tree — use const and selective rebuilds.---
description: "Layout & Styling"
alwaysApply: false
---
- Use layout widgets (Row, Column, Stack, Expanded, Flexible).
- Use SizedBox and Spacer for spacing — avoid hardcoded padding.
- Use MediaQuery and LayoutBuilder for responsive layouts.
- Use Theme and ThemeData for consistent styling.
- Use Theme.of(context) to access theme values.
- Define text styles, colors, and spacing in a centralized theme.---
description: "Navigation & Routing"
alwaysApply: false
---
- Use GoRouter for declarative routing with deep linking.
- Use Navigator 2.0 patterns for complex navigation.
- Pass arguments with typed route parameters.
- Use named routes for clarity and maintainability.
- Handle back navigation with proper state management.
- Use route guards for authentication flows.Customize These Rules
The generator below is preloaded with the Flutter template. Adjust indentation, quotes, naming, add your own rules, then download — no need to start from scratch on the homepage.
What This Template Covers
Required guidance
- - Widget Structure
- - State Management
- - Layout & Styling
- - Navigation & Routing
Default style
- - Indentation: 2 spaces
- - Quotes: single
- - Semicolons: disabled
- - Naming: camelCase
Frequently Asked Questions
- What does the Flutter Cursor rules template include?
- It includes 4 rule sections covering widget structure, state management, layout & styling and other Flutter development conventions.
- Can I generate Flutter Project Rules and AGENTS.md from the same template?
- Yes. The generator can export the same stack-specific guidance as modern Project Rules (.mdc), AGENTS.md, or a legacy .cursorrules file.
- Should I combine Flutter with other Cursor rules templates?
- Yes. You can combine Flutter with related templates such as TypeScript, Tailwind CSS, Docker, or backend frameworks when your project uses multiple technologies.