🦋

JetBrains AI Rules for Flutter + Dart

Cross-platform mobile app with Flutter and Dart

FlutterDartMobileCross-Platform
guidelines.md
# 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 JetBrains AI Rules for Flutter + Dart

The guidelines.md file helps JetBrains AI understand your Flutter + Dart 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 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.

How to use this file

  1. Click Copy or Download above.
  2. Place the guidelines.md file in your project's root directory.
  3. JetBrains AI will automatically detect and apply these rules.

Get Flutter + Dart Rules for Other IDEs

Other JetBrains AI Presets