AI rules for Flutter and Dart
This guide covers how you can leverage AI rules to streamline your Flutter and Dart development.
Overview
#AI-powered editors use rules files to provide context and instructions to an underlying LLM. These files help you:
- Customize AI behavior to your team's needs.
- Enforce project best practices for code style and design.
- Provide critical project context to the AI.
Environments that support rules
#Many AI environments support rules files to guide LLM behavior. Here are some common examples and their corresponding rule file names:
Environment | Rules File | Installation Instructions |
---|---|---|
Copilot powered IDEs | copilot-instructions.md |
Configure .github/copilot-instructions.md |
Cursor | cursor.md |
Configure cursorrules.md |
Firebase Studio | airules.md |
Configure airules.md |
Gemini CLI | GEMINI.md |
Configure GEMINI.md |
JetBrains IDEs | guidelines.md |
Configure guidelines.md |
VS Code | .instructions.md |
Configure .instructions.md |
Windsurf | guidelines.md |
Configure guidelines.md |
Create rules for your editor
#You can adapt our Flutter and Dart rules template for your specific environment. To do so, follow these steps:
-
Download the Flutter and Dart rules template: rules.md
-
In an LLM like Gemini, attach the
rules.md
file that you downloaded in the last step. -
Provide a prompt to reformat the file for your desired editor.
Example prompt:
textConvert the attached rules.md file into a guidelines.md file for Gemini CLI. Make sure to use the styles required for a guidelines.md file.
-
Review the LLM's output and make any necessary adjustments.
-
Follow your environment's instructions to add the new rules file. This may involve adding to an existing file or creating a new one.
-
Verify that your AI assistant is using the new rules to guide its responses.
除非另有说明,本文档之所提及适用于 Flutter 的最新稳定版本,本页面最后更新时间: 2025-09-18。 查看文档源码 或者 为本页面内容提出建议.