generate static method
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!
''';
}