Skip to content
Cursor Rules Generator
Mobile4 sections

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.

What This Template Covers

The template focuses Cursor AI on concrete Flutter practices instead of generic coding advice. Required sections are always included; optional sections can be enabled when they match your project.

Required guidance

  • - Widget Structure
  • - State Management
  • - Layout & Styling
  • - Navigation & Routing

Default style

  • - Indentation: 2 spaces
  • - Quotes: single
  • - Semicolons: disabled
  • - Naming: camelCase

Example Flutter Rules

The generator turns these sections into Project Rules with frontmatter, AGENTS.md, or a single .cursorrules file depending on the output format you choose.

Widget Structure

- Use composition over inheritance — prefer StatelessWidget and StatefulWidget.
- Use 2 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.

State Management

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

Layout & Styling

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

Common Searches This Page Helps With

flutter cursor rulesflutter .cursorrulesflutter AGENTS.md

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.

Related Cursor Rules Templates