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.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!
''';
}