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.dev/packages/appforge_cli](https://pub.dev/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!
''';
}