flutter_code_combiner 1.0.1-dev.1
flutter_code_combiner: ^1.0.1-dev.1 copied to clipboard
A Flutter package to combine all Flutter project files into a single file for AI tools
Flutter Code Combiner #
A powerful Flutter utility that combines your entire Flutter project's source code into a single, well-organized file. Perfect for working with AI tools, code analysis, and Large Language Models like ChatGPT, Claude, or Github Copilot.
Installation #
You can install this package in two ways:
1. From pub.dev #
Add this to your package's pubspec.yaml file:
dependencies:
flutter_code_combiner: ^1.0.0-dev.1
Then run:
dart pub get
2. From Git #
Add this to your package's pubspec.yaml file:
dependencies:
flutter_code_combiner:
git:
url: https://github.com/chipcoiga/flutter_code_combiner.git
ref: master
Usage #
Command Line Interface (CLI) #
- Activate the package globally:
dart pub global activate flutter_code_combiner
- Run the command:
# Basic usage
flutter_code_combiner --input /path/to/flutter/project --output combined_code.txt
# Show help
flutter_code_combiner --help
Programmatic Usage #
import 'package:flutter_code_combiner/flutter_code_combiner.dart';
void main() async {
try {
// Combine project files
final combined = await FlutterCodeCombiner.combineProject('/path/to/flutter/project');
// Use the combined code
print(combined);
// Or save to file
await File('combined_code.txt').writeAsString(combined);
} catch (e) {
print('Error: $e');
}
}
Output Format #
The combined output includes:
- Project metadata from pubspec.yaml
- List of dependencies
- All Dart files from:
- lib/ directory
- test/ directory (if exists)
Example output:
// Project: my_flutter_app
// Version: 1.0.0
// Description: A new Flutter project
// Dependencies:
// - flutter: sdk
// - cupertino_icons: ^1.0.2
// Combined Flutter Code:
// File: lib/main.dart
// ----------------
import 'package:flutter/material.dart';
...
// File: lib/src/widget.dart
// ----------------
class MyWidget extends StatelessWidget {
...
Features #
- Combines all Flutter/Dart files into a single organized file
- Preserves file structure information in comments
- Includes project metadata and dependencies
- Support for both CLI and programmatic usage
- Works with test files
- AI-friendly output format
Use Cases #
- Generate context for AI code assistants
- Create comprehensive code documentation
- Prepare code for LLM analysis
- Simplify code sharing and review
- Create backups with full project context
Contributing #
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License #
This project is licensed under the MIT License - see the LICENSE file for details.
Troubleshooting #
Common issues and solutions:
-
Permission Denied:
chmod +x $(which flutter_code_combiner) -
Command Not Found: Make sure the pub cache bin directory is in your PATH.
export PATH="$PATH":"$HOME/.pub-cache/bin" -
Dart SDK Version Error: Update your Dart SDK or use a compatible version as specified in pubspec.yaml.