flutter_blueprint 2.0.2
flutter_blueprint: ^2.0.2 copied to clipboard
Production-ready Flutter CLI scaffolding tool with multi-platform support, advanced state management (Provider/Riverpod/Bloc), universal API configurator, enterprise security (OWASP headers, certifica [...]
π― flutter_blueprint #
Enterprise-grade Flutter app scaffolding CLI β generates production-ready Flutter projects with 43+ professional files, complete architecture, and best practices.
π± Note: CLI runs on desktop (Windows/Linux/macOS) to generate Flutter projects that support all platforms (Android, iOS, Web, Desktop).
π What's New in v2.0 #
Major architectural improvements and production-ready features:
| Enhancement | Description |
|---|---|
| π₯ Complete Features | Auth, Profile, Settings with full UI - zero placeholders |
| π Smart Home Screen | API-connected with pagination, caching, pull-to-refresh |
| π Full Authentication | Login, Register, Token management, Auto-login, Secure storage |
| π€ Profile Management | View, Edit profile, Avatar upload, Offline-first caching |
| βοΈ Settings System | Theme switcher, Notifications, Biometrics, Account management |
| π Enterprise Security | OWASP-compliant headers, certificate pinning, SSRF prevention |
| π¦ Rate Limiting | Client-side protection (60 req/min per endpoint) |
| πΎ Smart Caching | SharedPreferences + JSON serialization with error recovery |
| ποΈ Architecture Refactor | Result types, command pattern, DI container |
| β Testing | 334 tests passing, 62.88% coverage |
See CHANGELOG.md for complete details.
π Quick Start #
Installation #
# Windows (PowerShell)
iex (irm 'https://rawgit.flutter-io.cn/chirag640/flutter_blueprint-Package/main/scripts/install.ps1')
# macOS / Linux
dart pub global activate flutter_blueprint
Create a Project #
# Interactive wizard (recommended)
flutter_blueprint init
# Quick mode with options
flutter_blueprint init my_app --state riverpod --api --theme --tests
β¨ Key Features #
| Category | Features |
|---|---|
| Architecture | Clean architecture, 60+ files, feature-based structure |
| Complete Features | Home (API + pagination), Auth (login/register), Profile (view/edit), Settings (theme/prefs) |
| State Management | Provider, Riverpod, or Bloc |
| API Layer | Dio + Auth/Retry/Logger/Security/RateLimit interceptors, Universal API Configurator |
| Storage | LocalStorage + SecureStorage + Hive caching with JSON serialization |
| Security | OWASP headers, error sanitization, SSRF prevention, certificate pinning, rate limiting |
| UI Components | Theme system, reusable widgets, Material 3 |
| DevOps | GitHub Actions, GitLab CI, Azure Pipelines |
| Extras | Pagination, Analytics, Security utilities, i18n |
π― Production-Ready Features #
When you generate a project with --api flag, you get complete working features with zero placeholders:
π Home Feature #
- API Integration: Real data from JSONPlaceholder demo API
- Pagination: Load more with infinite scroll
- Caching: 1-hour TTL with offline-first pattern
- UI: Pull-to-refresh, loading states, error handling
π Authentication Feature (with --api) #
- Login & Register: Complete forms with validation
- Token Management: JWT access + refresh tokens, secure storage
- Auto-login: Checks auth status on app startup
- UI: Beautiful login/register pages, error messages, loading states
π€ Profile Feature (with --api) #
- View Profile: Display user info with avatar
- Edit Profile: Update name, bio, phone, location
- Avatar Upload: Image picker integration (demo mode)
- Caching: Offline-first with 1-hour TTL
βοΈ Settings Feature (always included) #
- Theme Switcher: Light, Dark, System modes
- Notifications: Toggle push notifications
- Biometrics: Enable/disable biometric login
- Account: Profile link, Logout (if auth enabled)
- About: Version, Terms, Privacy Policy
- Data Management: Clear all cached data
π Security Features (v2.0+) #
flutter_blueprint generates enterprise-grade security out of the box:
π‘οΈ Security Headers #
- X-Content-Type-Options: Prevents MIME-sniffing attacks
- X-Frame-Options: Clickjacking protection (DENY)
- X-XSS-Protection: Legacy XSS protection layer
- Strict-Transport-Security: Forces HTTPS (1 year + subdomains)
- Cache-Control: Prevents sensitive data caching
π Certificate Pinning #
Prevent MITM attacks with SHA-256 fingerprint validation:
final dio = ApiClient(
baseUrl: 'https://api.example.com',
certificatePins: ['sha256/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA='],
).dio;
π¦ Rate Limiting #
Client-side protection with 60 requests/minute per endpoint:
- Automatic retry-after calculation
- Rolling window tracking
- Prevents API abuse
π§Ή Error Sanitization #
Security interceptor automatically removes:
- File paths (Windows/Unix)
- IP addresses (IPv4/IPv6)
- Long tokens (32+ characters)
- SSRF prevention (blocks localhost in production)
β Security Validation #
Built-in security audit helper:
final result = SecurityConfig.checkSecurityConfiguration(dio);
print('Security checks: ${result.passed} passed, ${result.issues.length} issues');
π οΈ CLI Commands #
init - Create New Project #
flutter_blueprint init <app_name> [options]
| Flag | Description |
|---|---|
--state <choice> |
State management: provider, riverpod, bloc |
--platforms <list> |
Target: mobile, web, desktop, all |
--ci <provider> |
CI/CD: github, gitlab, azure |
--api |
Include API client (prompts for backend type) |
--theme |
Include theme system |
--env |
Include environment config |
--tests |
Include test scaffolding |
--hive |
Include Hive offline caching |
--pagination |
Include pagination support |
--analytics <provider> |
Analytics: firebase, sentry |
--security <level> |
Security: basic, standard, enterprise |
π API Backend Presets #
When --api is enabled, choose from built-in presets:
- Modern REST - HTTP 200 + JSON data
- Legacy .NET - success: true/false pattern
- Laravel - data wrapper, message field
- Django REST - results array, detail errors
- Custom - manual configuration
add feature - Add Features to Existing Project #
flutter_blueprint add feature <name> [--api] [--no-data] [--no-domain]
π Generated Structure #
my_app/
βββ lib/
β βββ main.dart
β βββ app/app.dart
β βββ core/
β β βββ api/ # API client + interceptors
β β βββ config/ # App config + env loader
β β βββ errors/ # Exceptions + failures
β β βββ routing/ # Router + guards
β β βββ storage/ # Local + secure storage
β β βββ theme/ # Colors, typography, themes
β β βββ utils/ # Logger, validators, extensions
β β βββ widgets/ # Reusable UI components
β βββ features/ # Feature modules
βββ test/ # Test scaffolding
βββ pubspec.yaml
πΎ Data Layer Features (v2.0+) #
Smart Caching #
Production-ready cache implementation with SharedPreferences:
// Auto-generated cache methods
final items = await localDataSource.getCached(); // Returns List<T> or null
await localDataSource.cache(items); // JSON serialization
await localDataSource.clearCache(); // Clear cache
- Automatic JSON serialization/deserialization
- Error recovery (auto-clears corrupted cache)
- Type-safe operations
Auth Token Management #
Flexible token handling with callback-based interceptors:
final dio = ApiClient(
baseUrl: 'https://api.example.com',
getToken: () async => await storage.getToken(),
refreshToken: () async => await authService.refresh(),
).dio;
- Automatic 401 handling with token refresh
- Request retry after refresh
- Works with any auth strategy (OAuth, JWT, custom)
Offline Sync #
Hive-based offline support with API synchronization:
- Queue changes while offline
- Auto-sync when connection restored
- Conflict resolution strategies
π€ Team Collaboration #
Share configurations across your team:
# Import team config
flutter_blueprint share import ./company_standard.yaml
# Create project from config
flutter_blueprint init my_app --from-config company_standard
π Documentation #
- Architecture Guide - Deep dive into v2.0 architecture
- Example Usage - Programmatic API examples
- Contributing Guide - How to contribute
- Changelog - Version history
π License #
MIT License - see LICENSE
π¬ Support #
- π§ Email: chaudharychirag640@gmail.com
- π GitHub Issues
- π¬ Discussions
Made with β€οΈ for the Flutter community β