generate static method

String generate({
  1. required String projectName,
  2. required String stateManagement,
  3. required String authType,
  4. List<String> firebaseModules = const [],
  5. List<String> selectedModules = const [],
  6. List<String> selectedLanguages = const ['en'],
  7. bool includeChatbot = false,
  8. bool includeWeb = false,
  9. bool includeDocker = false,
})

Implementation

static String generate({
  required String projectName,
  required String stateManagement,
  required String authType,
  List<String> firebaseModules = const [],
  List<String> selectedModules = const [],
  List<String> selectedLanguages = const ['en'],
  bool includeChatbot = false,
  bool includeWeb = false,
  bool includeDocker = false,
}) {
  final formattedProjectName = _formatProjectName(projectName);
  final authFeatures = _getAuthFeatures(authType);
  final firebaseFeatures = _getFirebaseFeatures(firebaseModules);
  final utilityModules = _getUtilityModules(selectedModules);
  final localizationFeatures = _getLocalizationFeatures(selectedLanguages);
  final authFlowExamples = _getAuthFlowExamples(authType);

  return '''
# πŸš€ $formattedProjectName

A production-ready Flutter mobile application generated using **AppForge CLI**.

This project follows clean architecture, modern Flutter best practices, and comes with pre-configured authentication, theming, routing${firebaseModules.isNotEmpty ? ', and Firebase integration' : ''}.

---

## 🧱 Tech Stack

- **Flutter** ${includeWeb ? '(Android, iOS & Web)' : '(Android & iOS)'}
- **Dart**
- **State Management**: ${_formatStateManagement(stateManagement)}
- **Navigation**: GoRouter
- **Architecture**: Feature-based clean architecture${firebaseModules.isNotEmpty ? '\n- **Backend**: Firebase' : ''}${includeDocker ? '\n- **Deployment**: Docker + Nginx' : ''}

---

## ✨ Features Included

### 🎨 UI & Theming
- Material 3 design system
- Light & Dark mode support
- Responsive layouts (mobile & tablet)
- 12+ custom reusable widgets
- Smooth animations & transitions

### πŸ” Authentication
$authFeatures

${firebaseModules.isNotEmpty ? '''### πŸ”₯ Firebase Integration
$firebaseFeatures
''' : ''}${selectedModules.isNotEmpty ? '''### 🧩 Utility Modules
$utilityModules
''' : ''}${includeChatbot ? '''### πŸ€– AI Chatbot
- Powered by Google Gemini AI
- Beautiful chat UI with message bubbles
- Real-time typing indicators
- BLoC state management for chat
- Context-aware responses
''' : ''}${selectedLanguages.length > 1 ? '''### 🌍 Localization
$localizationFeatures
''' : ''}${includeDocker ? '''### 🐳 Docker Deployment (Web Only)
- Multi-stage Docker build
- Nginx reverse proxy
- Docker Compose orchestration
- Production-ready configuration
- CI/CD with GitHub Actions
''' : ''}
---

## πŸ“‚ Project Structure

\`\`\`
lib/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ router/              # GoRouter configuration
β”‚   └── theme/               # App theming (Light/Dark)
β”œβ”€β”€ features/
β”‚   β”œβ”€β”€ auth/                # Authentication feature
β”‚   β”‚   β”œβ”€β”€ screens/         # Login, Signup, OTP
β”‚   β”‚   └── services/        # Auth service layer
β”‚   β”œβ”€β”€ home/                # Home screen
β”‚   └── profile/             # Profile & settings${includeChatbot ? '\nβ”‚   └── chatbot/             # AI Chatbot feature\nβ”‚       β”œβ”€β”€ screens/\nβ”‚       β”œβ”€β”€ services/\nβ”‚       β”œβ”€β”€ models/\nβ”‚       └── bloc/' : ''}
β”œβ”€β”€ core/
β”‚   β”œβ”€β”€ firebase/            # Firebase operations${selectedModules.isNotEmpty ? '\nβ”‚   β”œβ”€β”€ modules/             # Utility modules\nβ”‚   β”‚   β”œβ”€β”€ camera/\nβ”‚   β”‚   β”œβ”€β”€ voice/\nβ”‚   β”‚   └── call/' : ''}
β”‚   └── providers/           # App-wide providers
β”œβ”€β”€ shared/
β”‚   └── widgets/             # Reusable UI components
β”‚       β”œβ”€β”€ buttons/
β”‚       β”œβ”€β”€ inputs/
β”‚       β”œβ”€β”€ cards/
β”‚       └── dialogs/
└── main.dart
\`\`\`

---

## ▢️ Getting Started

### Prerequisites
- Flutter SDK (>=3.0.0)
- Dart SDK (>=3.0.0)${firebaseModules.isNotEmpty ? '\n- Firebase CLI (for Firebase setup)\n- Node.js (for Firebase CLI)' : ''}${includeDocker ? '\n- Docker & Docker Compose (for web deployment)' : ''}

### 1️⃣ Install dependencies
\`\`\`bash
cd $projectName
flutter pub get
\`\`\`

### 2️⃣ Run the app
\`\`\`bash
flutter run
\`\`\`
${includeWeb ? '''
### 🌐 Run on Web
\`\`\`bash
flutter run -d chrome
\`\`\`
''' : ''}
---
${firebaseModules.isNotEmpty ? '''
## πŸ”₯ Firebase Setup

If Firebase was enabled during project creation, you need to configure it:

### Step 1: Login to Firebase
\`\`\`bash
firebase login
\`\`\`

### Step 2: Configure Firebase for your project
\`\`\`bash
cd $projectName
flutterfire configure
\`\`\`

This will:
- Let you select or create a Firebase project
- Configure iOS and Android automatically
- Generate \`firebase_options.dart\`

### Step 3: Re-run pub get
\`\`\`bash
flutter pub get
\`\`\`

### Firebase Console
Manage your project at: [Firebase Console](https://console.firebase.google.com)

---
''' : ''}
## πŸ” Authentication Flow

$authFlowExamples
${includeChatbot ? '''
---

## πŸ€– AI Chatbot Setup

### Step 1: Get Gemini API Key
1. Go to [Google AI Studio](https://makersuite.google.com/app/apikey)
2. Create a new API key
3. Copy the key

### Step 2: Add API Key
Open \`lib/core/constants/app_constants.dart\` and add your key:

\`\`\`dart
class AppConstants {
static const String geminiApiKey = 'YOUR_API_KEY_HERE';
}
\`\`\`

### Step 3: Run the app
The chatbot will be accessible from the home screen.

---
''' : ''}${selectedModules.isNotEmpty ? '''
## 🧩 Utility Modules Usage

${selectedModules.contains('camera') ? '''### πŸ“Έ Camera
\`\`\`dart
import 'package:$projectName/core/modules/modules.dart';

// Pick image from camera
final image = await CameraService.pickImage(source: ImageSource.camera);

// Pick from gallery
final image = await CameraService.pickImage(source: ImageSource.gallery);
\`\`\`
''' : ''}${selectedModules.contains('speech') ? '''### 🎀 Speech-to-Text
\`\`\`dart
import 'package:$projectName/core/modules/modules.dart';

final speechService = SpeechService();

// Start listening
await speechService.startListening(
onResult: (text) {
  print('Recognized: \$text');
},
);

// Stop listening
await speechService.stopListening();
\`\`\`

### πŸ”Š Text-to-Speech
\`\`\`dart
import 'package:$projectName/core/modules/modules.dart';

final ttsService = TtsService();

// Speak text
await ttsService.speak('Hello, welcome to my app!');

// Stop speaking
await ttsService.stop();
\`\`\`
''' : ''}${selectedModules.contains('recorder') ? '''### πŸŽ™οΈ Audio Recorder
\`\`\`dart
import 'package:$projectName/core/modules/modules.dart';

final recorder = AudioRecorderService();

// Start recording
await recorder.startRecording();

// Pause recording
await recorder.pauseRecording();

// Resume recording
await recorder.resumeRecording();

// Stop and get file path
final path = await recorder.stopRecording();
\`\`\`
''' : ''}${selectedModules.contains('call') ? '''### πŸ“ž Phone Call
\`\`\`dart
import 'package:$projectName/core/modules/modules.dart';

// Make a phone call
await CallService.makeCall('+911234567890');

// Send SMS
await CallService.sendSMS('+911234567890', 'Hello!');
\`\`\`
''' : ''}
---
''' : ''}${selectedLanguages.length > 1 ? '''
## 🌍 Localization

This app supports multiple languages: **${selectedLanguages.join(', ')}**

### Change Language
\`\`\`dart
import 'package:$projectName/core/providers/locale_provider.dart';

// In your widget
final localeProvider = Provider.of<LocaleProvider>(context);

// Change to Spanish
localeProvider.setLocale(Locale('es'));
\`\`\`

### Add New Translations
1. Edit ARB files in \`lib/l10n/\`
2. Run: \`flutter gen-l10n\`
3. Restart the app

For more details, see \`LOCALIZATION.md\`

---
''' : ''}
## πŸ“± Permissions

This project automatically configures native permissions.

### Android
The following permissions are configured in \`android/app/src/main/AndroidManifest.xml\`:
- βœ… Internet access
- βœ… Network state${selectedModules.contains('camera') ? '\n- βœ… Camera\n- βœ… Storage' : ''}${selectedModules.contains('speech') || selectedModules.contains('recorder') ? '\n- βœ… Microphone\n- βœ… Record audio' : ''}${selectedModules.contains('call') ? '\n- βœ… Phone call\n- βœ… Phone state' : ''}${selectedModules.contains('contacts') ? '\n- βœ… Read contacts\n- βœ… Write contacts' : ''}

### iOS
The following permissions are configured in \`ios/Runner/Info.plist\`:
- βœ… Network access${selectedModules.contains('camera') ? '\n- βœ… Camera usage description\n- βœ… Photo library usage' : ''}${selectedModules.contains('speech') || selectedModules.contains('recorder') ? '\n- βœ… Microphone usage description\n- βœ… Speech recognition usage' : ''}${selectedModules.contains('contacts') ? '\n- βœ… Contacts usage description' : ''}

You can customize permission descriptions in the respective files.

---

## πŸ§ͺ Testing

\`\`\`bash
# Run all tests
flutter test

# Run with coverage
flutter test --coverage
\`\`\`

---

## πŸš€ Build & Deploy

### Android
\`\`\`bash
# Debug APK
flutter build apk

# Release APK
flutter build apk --release

# App Bundle (for Play Store)
flutter build appbundle --release
\`\`\`

### iOS
\`\`\`bash
# Release build
flutter build ios --release

# Or open in Xcode
open ios/Runner.xcworkspace
\`\`\`
${includeWeb ? '''
### Web
\`\`\`bash
# Build for web
flutter build web --release

# Serve locally
flutter run -d chrome
\`\`\`
''' : ''}${includeDocker && includeWeb ? '''
### 🐳 Docker Deployment (Web Only)

\`\`\`bash
# Build Docker image
make build

# Run production
make run

# Run development with hot-reload
make dev

# Stop containers
make stop

# View logs
make logs
\`\`\`

For complete Docker documentation, see \`DOCKER.md\`
''' : ''}
---

## 🧠 Best Practices

### Code Organization
- βœ… Keep business logic inside \`features/\`
- βœ… Use shared widgets from \`shared/widgets/\`
- βœ… Avoid direct Firebase calls in UI
- βœ… Follow state management conventions (${stateManagement})

### State Management
${_getStateManagementBestPractices(stateManagement)}

### Performance
- βœ… Use \`const\` constructors where possible
- βœ… Avoid rebuilding entire widget trees
- βœ… Use \`ListView.builder\` for long lists
- βœ… Implement proper image caching

### Security
${firebaseModules.isNotEmpty ? '- βœ… Never commit Firebase config files to public repos\n' : ''}- βœ… Use environment variables for API keys
- βœ… Implement proper authentication flows
- βœ… Validate all user inputs
- βœ… Use HTTPS for all network calls

---

## πŸ“š Resources

### Flutter
- [Official Documentation](https://docs.flutter.dev/)
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)

### State Management
${_getStateManagementResources(stateManagement)}
${firebaseModules.isNotEmpty ? '''
### Firebase
- [FlutterFire Documentation](https://firebase.flutter.dev/)
- [Firebase Console](https://console.firebase.google.com/)
''' : ''}${includeChatbot ? '''
### Google Gemini AI
- [Google AI Studio](https://makersuite.google.com/)
- [Gemini API Documentation](https://ai.google.dev/docs)
''' : ''}
---

## πŸ› Troubleshooting

${firebaseModules.isNotEmpty ? '''### Firebase Issues
**Problem**: "Firebase not configured"
- **Solution**: Run \`flutterfire configure\` in your project directory

**Problem**: "Google Services missing"
- **Solution**: Download \`google-services.json\` (Android) and \`GoogleService-Info.plist\` (iOS) from Firebase Console
''' : ''}
### Build Issues
**Problem**: "Dependencies conflict"
- **Solution**: Run \`flutter pub get\` or \`flutter clean && flutter pub get\`

**Problem**: "Android build fails"
- **Solution**: Check that minSdk is set to 23 in \`android/app/build.gradle.kts\`

### Permission Issues
**Problem**: "Permission denied at runtime"
- **Solution**: Make sure permissions are requested before use. Check \`permission_handler\` documentation.

---

## πŸ“„ License

This project is generated using AppForge CLI and is free to modify and distribute.

---

## πŸ™Œ Generated Using

**AppForge CLI** - Production-ready Flutter App Generator

- πŸ“¦ [pub.flutter-io.cn/packages/appforge_cli](https://pub.flutter-io.cn/packages/appforge_cli)
- 🌟 [GitHub Repository](https://github.com/appforge-cli/appforge_cli/)

### Features
βœ… Clean Architecture
βœ… Multiple Auth Options
βœ… Firebase Integration
βœ… Utility Modules
βœ… Multi-language Support
βœ… Docker Support
βœ… Production Ready

---

**Happy Coding! πŸš€**

If you find this helpful, please give it a ⭐ on GitHub!
''';
}