Flutter + Dart Rules
Cross-platform mobile app with Flutter and Dart
# Role
You are an expert Flutter developer building cross-platform applications with Dart.
# Tech Stack
- Flutter 3
- Dart 3
- Riverpod
- Go Router
- Freezed
# Code Conventions
- Use Riverpod for state management.
- Follow the feature-first folder structure: features/[name]/{data, domain, presentation}.
- Use `const` constructors wherever possible for performance.
- Use Freezed for immutable data classes and union types.
- Use Go Router for navigation and deep linking.
- Extract widgets into separate files when they exceed 80 lines.
- Use `async/await` for asynchronous operations.
- Follow Dart naming conventions: lowerCamelCase for variables, UpperCamelCase for classes.
# Code Style Preferences
- Use TypeScript strict mode. Define types for all variables, parameters, and return values.
- Never use the `any` type. Use `unknown` if the type is truly uncertain, then narrow it.
- Use `const` by default. Only use `let` when reassignment is needed. Never use `var`.
- Always handle errors explicitly. Use try/catch for async operations. Never silently swallow errors.
- Use early returns (guard clauses) to reduce nesting and improve readability.
- Use descriptive, meaningful names for variables, functions, and classes. Avoid abbreviations.
- Keep functions small and focused. Each function should do one thing. Aim for under 50 lines.
# What to Avoid
- Do not use `setState` for complex state — use Riverpod.
- Do not create deeply nested widget trees — extract widgets.
- Do not use `dynamic` type unless necessary.
- Do not ignore linter warnings.
About Flutter + Dart AI Rules
AI coding rules files help your AI assistant (Cursor, Windsurf, Claude Code, GitHub Copilot, or Cline) understand your project's conventions, tech stack, and coding standards. This ensures the AI generates code that matches your team's style and follows best practices for Flutter.
This preset is designed for Flutter + Dart projects and includes rules for:
- Use Riverpod for state management.
- Follow the feature-first folder structure: features/[name]/{data, domain, presentation}.
- Use `const` constructors wherever possible for performance.
- Use Freezed for immutable data classes and union types.
- Use Go Router for navigation and deep linking.
Simply select your preferred AI IDE format above, then copy or download the generated rules file. Place it in your project's root directory and your AI assistant will automatically follow these conventions.
Get This Preset for a Specific IDE
Cursor
Flutter + Dart rules for Cursor
Windsurf
Flutter + Dart rules for Windsurf
Claude Code
Flutter + Dart rules for Claude Code
GitHub Copilot
Flutter + Dart rules for GitHub Copilot
Cline
Flutter + Dart rules for Cline
Zed AI
Flutter + Dart rules for Zed AI
Aider
Flutter + Dart rules for Aider
Continue.dev
Flutter + Dart rules for Continue.dev
Devin AI
Flutter + Dart rules for Devin AI
Amazon Q
Flutter + Dart rules for Amazon Q
Bolt.new
Flutter + Dart rules for Bolt.new
Lovable
Flutter + Dart rules for Lovable
Replit AI
Flutter + Dart rules for Replit AI
Augment Code
Flutter + Dart rules for Augment Code
JetBrains AI
Flutter + Dart rules for JetBrains AI