This project leverages Google's Gemini Code Assist. Learn more about writing code with Gemini from the official documentation.
A Flutter project demonstrating how to add MCP server and rules to Google's Gemini Code Assist to tailor its code generation and assistance within your development workflow.
To use this project effectively or apply these concepts, you first need to install Gemini Code Assist in your IDE.
- Open your IDE: This will likely be Visual Studio Code (VS Code) or Android Studio/IntelliJ IDEA.
- Navigate to Extensions/Plugins:
- VS Code: Click the Extensions icon in the Activity Bar (usually on the left, looks like square blocks) or press
Ctrl+Shift+X(Cmd+Shift+Xon macOS). - Android Studio/IntelliJ: Go to
File>Settings(orAndroid Studio>Preferenceson macOS), then selectPlugins. Make sure you're on theMarketplacetab.
- VS Code: Click the Extensions icon in the Activity Bar (usually on the left, looks like square blocks) or press
- Search for Gemini: Type
Gemini Code AssistorGoogle Geminiin the search bar. - Install: Find the official extension/plugin by Google and click "Install".
- Reload/Restart (if needed): Your IDE might prompt you to reload or restart.
- Sign In: After installation, follow the prompts to sign in with your Google account to activate Gemini Code Assist.
Once installed and activated, Gemini is ready to help!
To add a MAP server to the project you need to follow these steps:
- Add folder .gemini in the main project structure.
- Add file settings.json.
- Add the MCP server settings to the settings.json
{
"mcpServers": {
"dart": {
"command": "dart",
"args": [
"mcp-server"
]
}
}
}
You can guide Gemini's behavior by providing persistent instructions or "rules" that it will consider for every request you make. This helps ensure consistency and adherence to your project's specific standards or your personal preferences. There are two places you can add rules:
-
Navigate to:
C:\Users\[uasername]\.gemini -
Add: In the directory
C:\Users\[uasername]\.geminiaddGEMINI.md -
Add Your Rule(s): In the
GEMINI.mdadd the rules, or enter your instructions. You can add multiple rules, often one per line.Example Rule:
Always generate unit tests when creating a new function.
-
Navigate to:
[projectFolder] -
Add: In the directory
[projectFolder]addGEMINI.md\ -
Add Your Rule(s): In the
GEMINI.mdadd the rules, or enter your instructions. You can add multiple rules, often one per line.Example Rule:
Always generate unit tests when creating a new function.
After adding rules in the Rules settings, Gemini Code Assist considers the rule for every prompt or request you make.
To remove the rule, delete the content from the Gemini Code Assist: GEMINI.md
For detailed coding and project guidelines, please refer to the Gemini Code Assist Rules. These are the style and structure I prefer for my project. Please amend as needed for your project.
