FlashApi - Flutter BLoC Clean Architecture Generator

FlashApi is a powerful VS Code extension that automates Flutter BLoC clean architecture generation from API responses. Generate complete, production-ready Flutter applications with just a few clicks!
✨ Features
- 🚀 One-Click Generation: Generate complete Flutter BLoC clean architecture from API responses
- 🎯 Smart API Detection: Automatically detects Flutter projects and API endpoints
- 🏗️ Clean Architecture: Follows industry best practices with proper separation of concerns
- 📱 Complete UI Generation: Creates pages, widgets, and navigation automatically
- 🔧 Customizable: Support for GET, POST, PUT, DELETE, PATCH methods
- 📦 Dependency Injection: Auto-generates dependency injection setup
- 🎨 Modern UI: Beautiful, responsive webview interface
🚀 Quick Start
Prerequisites
- Flutter project with
pubspec.yaml
- FlashApi plugin added to dependencies
Installation
Install the Extension:
- Open VS Code
- Go to Extensions (Ctrl+Shift+X)
- Search for "FlashApi"
- Click Install
Add FlashApi Plugin to Your Flutter Project:
dependencies:
flashapi_generator: ^0.1.0
Open the Generator:
- Press
Ctrl+Shift+P
- Type "FlashApi"
- Select "FlashApi: Open Generator"
🎯 How to Use
- Feature Name: Enter your feature name (e.g., "todos", "users")
- API URL: Enter your API endpoint
- HTTP Method: Select GET, POST, PUT, DELETE, or PATCH
- Query Parameters: Add URL parameters (optional)
- Headers: Add authentication and content headers (optional)
- Request Body: Configure request payload (for POST/PUT/PATCH)
Step 2: Test API
- Click "Test API" to verify your endpoint
- View the response in the preview panel
Step 3: Generate Architecture
- Click "Generate BLoC Files"
- Watch as FlashApi creates your complete Flutter architecture!
🏗️ Generated Architecture
FlashApi creates a complete clean architecture structure:
lib/
├── core/
│ ├── api/
│ │ └── api_constants.dart
│ ├── client/
│ │ └── dio_client.dart
│ ├── error/
│ │ ├── exceptions.dart
│ │ └── failures.dart
│ └── injection/
│ └── injection_container.dart
├── features/
│ └── [feature_name]/
│ ├── data/
│ │ ├── datasources/
│ │ │ └── [feature]_remote_datasource.dart
│ │ ├── models/
│ │ │ └── [feature]_model.dart
│ │ └── repositories/
│ │ └── [feature]_repository_impl.dart
│ ├── domain/
│ │ ├── entities/
│ │ │ └── [feature].dart
│ │ ├── repositories/
│ │ │ └── [feature]_repository.dart
│ │ └── usecases/
│ │ └── get_[feature].dart
│ └── presentation/
│ ├── bloc/
│ │ ├── [feature]_bloc.dart
│ │ ├── [feature]_event.dart
│ │ └── [feature]_state.dart
│ └── pages/
│ ├── [feature]_page.dart
│ └── widgets/
│ └── [feature]_item.dart
└── main.dart
🎨 UI Features
Modern Interface
- Clean Design: Intuitive, user-friendly interface
- Real-time Preview: See API responses instantly
- Dynamic Forms: Smart form fields based on HTTP method
- Progress Indicators: Visual feedback during generation
Advanced Configuration
- Query Parameters: Dynamic key-value pairs
- Headers Management: Default and custom headers
- Request Body Types: Raw, JSON, XML, Form data, File upload
- Method Support: Full HTTP method support
🔧 Configuration
API Constants
FlashApi automatically generates api_constants.dart
:
class ApiConstants {
static const String baseUrl = 'https://jsonplaceholder.typicode.com';
static const String todosEndpoint = '/todos/1';
}
Dependency Injection
Auto-generated injection_container.dart
:
void init() {
// BLoC
sl.registerFactory(() => TodosBloc(getTodos: sl()));
// Use cases
sl.registerLazySingleton(() => GetTodos(sl()));
// Repository
sl.registerLazySingleton<TodosRepository>(() => TodosRepositoryImpl(sl()));
}
📱 Generated Features
Complete BLoC Implementation
- Events: Loading, success, error states
- States: Proper state management
- Repository Pattern: Clean data layer separation
- Error Handling: Comprehensive exception handling
UI Components
- Pages: Complete page implementations
- Widgets: Reusable UI components
- Navigation: Auto-generated navigation setup
- Responsive Design: Mobile-first approach
🚀 Advanced Usage
Multiple Features
FlashApi supports generating multiple features in the same project:
- Generate first feature (e.g., "todos")
- Generate second feature (e.g., "users")
- Both features will be available in navigation
Custom API Endpoints
- REST APIs: Full REST endpoint support
- Authentication: Bearer token, API key support
- Custom Headers: Content-Type, Authorization, etc.
- Request Bodies: JSON, XML, Form data support
🛠️ Development
Building from Source
git clone https://github.com/premkumarkota/flashapi
cd flashapi/vscode-extension
npm install
npm run build
Development Mode
# Start development host
npm run dev-mode
# Watch for changes
npm run watch
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
📞 Support
⭐ Star This Project
If you find FlashApi useful, please give it a star on GitHub!
Made with ❤️ by Prem Kumar Kota