Transform your Dart code from messy to magnificent with AI-powered automated fixes! π
Quick Start β’ Demo β’ Features β’ Installation β’ Usage β’ Configuration
dart_ment is your AI-powered companion that automatically fixes linting issues, improves code quality, and provides intelligent suggestions for your Dart/Flutter projects. Think of it as having a senior Dart developer reviewing and fixing your code 24/7!
- Save Hours: Stop manually fixing repetitive linting issues
- Learn Best Practices: Get AI-powered suggestions based on Dart/Flutter guidelines
- Improve Code Quality: Maintain consistent, clean code across your project
- Boost Productivity: Focus on features, not formatting
$ ment analyze
π Starting code analysis...
β Found 142 Dart files
β Analysis complete: 23 issues, 47 suggestions
π lib/src/user_service.dart
Issues (3):
β Missing type annotation for 'data'
β Avoid using 'dynamic' as a type
β Prefer const constructors
Suggestions (2):
π‘ Consider using a more specific return type
π‘ Extract this logic into a separate method
$ ment fix
π οΈ Starting fix process...
β Found 23 issues in 8 files
Generating fix... β Fix applied
Generating fix... β Fix applied
β Fixed 23 issues. Run "dart analyze" to verify the fixes.|
Leverages Google Gemini's understanding of Dart/Flutter to provide context-aware fixes |
Comprehensive static analysis that catches issues |
|
Preview changes with |
Analyzes and fixes hundreds of files in seconds with smart token optimization |
|
Enforces consistent code style across your entire project |
Get improvement recommendations beyond just linting fixes |
|
Analyze and fix specific directories without changing your working directory |
Only analyzes files with errors by default, saving API costs |
# 1. Install dart_ment globally
dart pub global activate dart_ment
# 2. Get your Gemini API key (free)
# Visit: https://makersuite.google.com/app/apikey
# 3. Run in your Dart/Flutter project
cd your_project
ment fix --api-key YOUR_GEMINI_API_KEY
# That's it! π- Dart SDK
>=3.5.0 - A Google Gemini API key (Get one free)
dart pub global activate dart_mentdev_dependencies:
dart_ment: ^0.2.0Get a comprehensive analysis of your codebase with AI-powered suggestions:
# Basic analysis
ment analyze
# Analyze a specific directory
ment analyze lib/src
ment analyze example
# With custom configuration
ment analyze --config analysis_config.yaml
# Disable AI suggestions (faster)
ment analyze --no-suggestions
# Analyze all files with AI (including files without errors)
ment analyze --all-files
# Analyze and automatically apply fixes
ment analyze --apply-fixesLet AI fix your linting issues intelligently:
# Fix with API key as parameter
ment fix --api-key YOUR_KEY
# Fix issues in a specific directory
ment fix lib
ment fix test
# Fix with environment variable
export GEMINI_API_KEY=YOUR_KEY
ment fix
# Preview fixes without applying
ment fix --dry-run
# Select a different AI model
ment fix --model gemini-1.5-pro
# Set maximum fix iterations (default: 3)
ment fix --max-iterations 5List and select from available Gemini models:
# List all available models
ment models --list
# Select a model interactively
ment models --select
# Set a specific model
ment models --set gemini-1.5-proManage your dart_ment configuration:
# Show current configuration
ment config show
# Set configuration values
ment config set model gemini-1.5-flash
# Show configuration file paths
ment config pathKeep dart_ment up to date with the latest improvements:
ment updatedart_ment stores configuration in your home directory at ~/.dart_ment/ for easy access across all projects.
Set your Gemini API key using one of these methods:
# Option 1: Using config command (stored securely)
ment config set gemini_api_key YOUR_API_KEY
# Option 2: Environment variable
export GEMINI_API_KEY=your_api_key_here
# Option 3: Edit ~/.dart_ment/api_keys.yaml directlyConfiguration is stored at ~/.dart_ment/config.yaml:
# Default AI model
model: gemini-1.5-flash
# Analysis Settings
analysis:
include:
- lib/**/*.dart
- bin/**/*.dart
- test/**/*.dart
exclude:
- "**/*.g.dart"
- "**/*.freezed.dart"
# Fix Settings
fixes:
backup: true # Create .backup files
interactive: false # Auto-apply fixes
max_suggestions: 3 # Suggestions per issuement fix \
--api-key YOUR_KEY \
--config custom_config.yaml \
--dry-run- π± Flutter Projects: Optimized for Flutter-specific patterns
- π’ Large Codebases: Fix hundreds of files in one command
- π₯ Team Projects: Enforce consistent code style
- π Learning: Understand why fixes are suggested
- β° CI/CD Pipelines: Automated code quality checks
- Before Code Reviews: Clean up your code automatically
- Legacy Code: Modernize old Dart code to current standards
- After Major Refactoring: Ensure consistency across changes
- New Team Members: Help them follow project conventions
We love contributions! See our Contributing Guide for details.
# Clone the repo
git clone https://github.com/yourusername/dart_ment.git
# Install dependencies
dart pub get
# Run tests
dart test
# Make your changes and submit a PR!New releases are automatically created when version tags are pushed:
# Tag a new version
git tag v0.1.0
git push origin v0.1.0This will automatically:
- Create a GitHub release with changelog
- Publish to pub.dev (if credentials are configured)
See .github/workflows/README.md for details.
- VS Code Extension
- Custom Lint Rules
- Team Style Guides
- Local LLM Support
- Fix History & Rollback
- Performance Metrics
This project is licensed under the MIT License - see the LICENSE file for details.
Made with π by the Dart community