starter_kit 1.0.2+1
starter_kit: ^1.0.2+1 copied to clipboard
A comprehensive, scalable, and production-ready Flutter boilerplate generator with clean architecture.
StarterKit - Flutter Boilerplate Generator #
Stop writing boilerplate. Start building features.
A comprehensive Flutter package that generates production-ready boilerplate with clean architecture, beautiful design system, and essential utilities in seconds.
β‘ Quick Start #
flutter pub add starter_kit # Add package
dart run starter_kit init # Generate boilerplate
dart run starter_kit add_screen Login # Create screens
dart run starter_kit add_api UserAPI # Add API services
π― What you get: Complete project structure, design system, network layer, utilities, and tests - all in under 30 seconds!
π Table of Contents #
π Getting Started #
π οΈ Core Features #
π¨ Design & Development #
π Guides & Examples #
π§ Advanced #
π What is StarterKit? #
StarterKit eliminates the tedious setup phase of Flutter projects. Instead of spending hours setting up folder structures, design systems, and boilerplate code, you get everything instantly.
π Traditional vs StarterKit Approach #
| Traditional Setup | β±οΈ Time | StarterKit | β±οΈ Time |
|---|---|---|---|
| Create folder structure | 30 min | dart run starter_kit init |
10 sec |
| Setup clean architecture | 2 hours | β Auto-generated | 0 sec |
| Design color system | 1 hour | β WeChat-inspired included | 0 sec |
| Create API client | 1 hour | β Production-ready client | 0 sec |
| Write form validators | 45 min | β Pre-built validators | 0 sec |
| Setup testing structure | 1 hour | β Complete test framework | 0 sec |
| Total Setup Time | ~6 hours | Total Setup Time | ~10 seconds |
π‘ Why Choose StarterKit? #
π― Core Benefits #
ββ SPEED βββββββββββββββββββββββββββββββββββββββββββββββββ
β β’ 25+ files generated in 10 seconds β
β β’ Skip repetitive boilerplate setup β
β β’ Focus on building features, not infrastructure β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββ QUALITY βββββββββββββββββββββββββββββββββββββββββββββββ
β β’ Industry-standard clean architecture β
β β’ Production-ready error handling β
β β’ Comprehensive testing structure β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββ CONSISTENCY βββββββββββββββββββββββββββββββββββββββββββ
β β’ Standardized project structure β
β β’ Unified coding patterns β
β β’ Team-friendly conventions β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π What Makes It Special #
- π Zero Configuration - Works out of the box
- π± Mobile-First - Optimized for Flutter development
- π¨ Beautiful Design - WeChat-inspired design system
- π§ͺ Test-Ready - Complete testing infrastructure
- π Scalable - Grows with your project needs
π First Steps #
π¬ Initialize Your Project #
dart run starter_kit init
β¨ This single command creates:
π¦ Your Flutter Project
βββ ποΈ Clean Architecture Setup
βββ π¨ Complete Design System
βββ π Production API Client
βββ π οΈ Utility Functions
βββ π§ͺ Testing Infrastructure
βββ π± Ready-to-use Components
π― What Gets Generated #
| Component | Files Created | Purpose |
|---|---|---|
| ποΈ Architecture | 8 files | Domain, Data, Presentation layers |
| π¨ Design System | 6 files | Colors, typography, components |
| π Network Layer | 3 files | API client, error handling |
| π οΈ Utilities | 5 files | Validators, helpers, navigation |
| π§ͺ Testing | 3 files | Unit, widget, integration tests |
π οΈ CLI Commands #
StarterKit provides 4 powerful commands to accelerate your development:
π Command Overview #
ββ COMMAND βββββββββββ¬β PURPOSE βββββββββββββββ¬β FILES ββ¬β TIME ββ
β init β Complete setup β 25+ β 10s β
ββββββββββββββββββββββΌβββββββββββββββββββββββββΌββββββββββΌβββββββββ€
β add_screen <name> β Create new screen β 2 β 2s β
ββββββββββββββββββββββΌβββββββββββββββββββββββββΌββββββββββΌβββββββββ€
β add_api <name> β Generate API service β 3 β 3s β
ββββββββββββββββββββββΌβββββββββββββββββββββββββΌββββββββββΌβββββββββ€
β add_model <name> β Create data model β 3 β 2s β
ββββββββββββββββββββββ΄βββββββββββββββββββββββββ΄ββββββββββ΄βββββββββ
π― Real-World Usage Examples #
π Building Authentication Flow
dart run starter_kit add_screen LoginScreen
dart run starter_kit add_screen SignupScreen
dart run starter_kit add_api AuthService
dart run starter_kit add_model User
π Creating E-commerce Features
dart run starter_kit add_screen ProductListScreen
dart run starter_kit add_screen ProductDetailScreen
dart run starter_kit add_api ProductService
dart run starter_kit add_model Product
π Command Details #
init - Project Foundation
- β Creates complete folder structure
- β Sets up clean architecture
- β Generates design system
- β Configures API client
- β Implements utilities
add_screen - UI Creation
- β Generates StatefulWidget
- β Includes proper imports
- β Creates widget test file
- β Follows naming conventions
add_api - Service Generation
- β Creates repository interface
- β Implements repository pattern
- β Generates unit tests
- β Includes error handling
add_model - Data Structures
- β Creates domain entity
- β Generates data model
- β Implements JSON serialization
- β Includes unit tests
ποΈ Project Architecture #
StarterKit implements Clean Architecture with clear separation of concerns:
π Architecture Layers #
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β PRESENTATION LAYER β
β β
β Screen Widgets β State Management β User Interactions β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β DOMAIN LAYER β
β β
β Business Logic β Entities β Repository Contracts β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β DATA LAYER β
β β
β API Calls β Data Models β Repository Implementation β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CORE LAYER β
β β
β Utilities β Configuration β Dependency Injection β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π― Layer Responsibilities #
| Layer | π― Focus | π Responsibilities | π Dependencies |
|---|---|---|---|
| π¨ Presentation | UI & UX | Widgets, screens, user interactions | Domain + Core |
| π§ Domain | Business Logic | Entities, use cases, business rules | Core only |
| πΎ Data | Data Access | API calls, caching, data transformation | Domain + Core |
| βοΈ Core | Infrastructure | Configuration, utilities, DI container | External packages |
π Benefits of This Architecture #
ββ MAINTAINABILITY βββββββββββββββββββββββββββββββββββββββ
β β’ Clear separation of concerns β
β β’ Easy to locate and modify code β
β β’ Reduced coupling between layers β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββ TESTABILITY βββββββββββββββββββββββββββββββββββββββββββ
β β’ Each layer can be tested independently β
β β’ Easy mocking of dependencies β
β β’ Clear test boundaries β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββ SCALABILITY βββββββββββββββββββββββββββββββββββββββββββ
β β’ Easy to add new features β
β β’ Supports team collaboration β
β β’ Framework-independent business logic β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π Generated Structure #
After running dart run starter_kit init:
π¦ your_project/
βββ π lib/
β βββ π starter_kit.dart # π Main exports
β βββ π src/
β βββ π core/ # βοΈ Core functionality
β β βββ π config/ # βοΈ App configuration
β β βββ π design_system/ # π¨ UI components & theme
β β βββ π di/ # π§ Dependency injection
β β βββ π network/ # π HTTP client
β β βββ π utils/ # π οΈ Helper functions
β βββ π data/ # πΎ Data layer
β β βββ π models/ # π Data models
β β βββ π repositories/ # πͺ Data repositories
β βββ π domain/ # π§ Business logic
β β βββ π entities/ # π Domain entities
β β βββ π repositories/ # π Repository contracts
β βββ π presentation/ # π¨ UI layer
β βββ π pages/ # π± Screen widgets
β βββ π widgets/ # π§© Reusable components
βββ π test/ # π§ͺ Testing
β βββ π unit/ # π¬ Unit tests
β βββ π widget/ # π Widget tests
β βββ π integration/ # π Integration tests
βββ π assets/ # π Resources
βββ π images/ # πΌοΈ Images
βββ π icons/ # π― Icons
βββ π fonts/ # π Custom fonts
π¨ Design System #
StarterKit includes a WeChat-inspired design system for consistent, beautiful UIs.
π¨ Color Palette #
Primary Colors - Main Actions
AppColors.primary- #07C160 (WeChat Green)AppColors.primaryDark- #05A050 (Hover states)AppColors.primaryLight- #4CD98B (Backgrounds)
Text Hierarchy
AppColors.textPrimary- #1A1A1A (Headings)AppColors.textSecondary- #8C8C8C (Body text)AppColors.textTertiary- #BFBFBF (Captions)
Status Colors
AppColors.success- #52C41A (Success states)AppColors.warning- #FAAD14 (Warning states)AppColors.error- #F5222D (Error states)AppColors.info- #1890FF (Info states)
π Typography Scale #
| Style | Size | Weight | Usage Example |
|---|---|---|---|
| h1 | 32px | Bold | Page titles, hero text |
| h2 | 28px | Bold | Section headers |
| h3 | 24px | SemiBold | Subsection titles |
| h4 | 20px | SemiBold | Card titles, form labels |
| bodyLarge | 16px | Regular | Main content, descriptions |
| bodyMedium | 14px | Regular | Secondary content |
| bodySmall | 12px | Regular | Supporting text, footnotes |
| button | 14px | Medium | Button labels |
| caption | 10px | Regular | Timestamps, metadata |
π§© Ready-to-Use Components #
π Buttons
PrimaryButton- Main actions (save, submit, continue)SecondaryButton- Secondary actions (cancel, back)
π Input Fields
AppTextField- Text inputs with validationAppDropdown- Selection dropdownsAppDatePicker- Date/time selection
π Layout Components
AppCard- Content containersAppScaffold- Page structureAppAppBar- Navigation bars
π Network & APIs #
StarterKit provides a production-ready HTTP client built on Dio.
π API Response Flow #
π± Your App Request
β
π‘οΈ API Client (StarterKit)
β
π HTTP Request (Dio)
β
πͺ External API
β
π¦ Raw Response
β
β¨ Processed Response (StarterKit)
β
π± Your App (Success/Error)
π Error Handling Matrix #
| Scenario | HTTP Code | StarterKit Response | User Experience |
|---|---|---|---|
| No Internet | - | "Connection failed" | Retry prompt |
| Request Timeout | - | "Request timed out" | Retry option |
| Unauthorized | 401 | "Login required" | Redirect to login |
| Forbidden | 403 | "Access denied" | Contact support |
| Not Found | 404 | "Resource not found" | Navigate back |
| Server Error | 500+ | "Server unavailable" | Try again later |
π§ Response Wrapper #
All API responses use a consistent format:
ApiResponse<T> {
β
data: T? // Success data
β errorMessage: String? // Error description
π isSuccess: bool // Status indicator
}
π οΈ Utilities & Helpers #
StarterKit includes battle-tested utilities for common development tasks.
β Form Validation #
Available Validators:
Validators.email- Email format validationValidators.password- Strong password requirementsValidators.phone- Phone number validationValidators.required- Required field validationValidators.minLength- Minimum character countValidators.maxLength- Maximum character count
π§ Navigation Helpers #
Simple Navigation:
NavigationUtils.push()- Navigate to screenNavigationUtils.pushReplacement()- Replace current screenNavigationUtils.pushAndClearStack()- Clear navigation history
User Feedback:
NavigationUtils.showSnackBar()- Show success/error messagesNavigationUtils.showAlertDialog()- Show confirmation dialogs
π€ String Utilities #
Text Manipulation:
'hello world'.capitalize()β 'Hello world''hello world'.toCamelCase()β 'helloWorld''HelloWorld'.toSnakeCase()β 'hello_world''Long text...'.truncate(10)β 'Long te...'
Validation Helpers:
'email@test.com'.isEmail()β true'+1234567890'.isPhoneNumber()β true'https://example.com'.isUrl()β true
π Date Utilities #
Formatting:
DateTime.now().formatDate()β 'Mar 15, 2024'DateTime.now().formatRelativeTime()β '2 hours ago'Duration(hours: 2).formatDuration()β '2h 0m'
π Complete Examples #
π Authentication Example #
Generate authentication components:
dart run starter_kit add_screen LoginScreen
dart run starter_kit add_api AuthService
dart run starter_kit add_model User
Simple login implementation:
// Minimal login screen example
class LoginScreen extends StatefulWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Login')),
body: Column(
children: [
AppTextField(
labelText: 'Email',
validator: Validators.email,
),
AppTextField(
labelText: 'Password',
obscureText: true,
validator: Validators.required,
),
PrimaryButton(
text: 'Sign In',
onPressed: () => _handleLogin(),
),
],
),
);
}
}
π E-commerce Example #
Generate e-commerce components:
dart run starter_kit add_screen ProductListScreen
dart run starter_kit add_api ProductService
dart run starter_kit add_model Product
π― Best Practices #
π Project Organization #
β
DO: Use provided folder structure
β
DO: Follow naming conventions
β
DO: Keep layers separated
β
DO: Write tests for new features
β DON'T: Mix presentation with business logic
β DON'T: Skip validation on user inputs
β DON'T: Ignore error handling
β DON'T: Hard-code configuration values
π§ Development Workflow #
- ποΈ Setup - Run
dart run starter_kit init - π± Screens - Generate with
add_screen - π APIs - Create with
add_api - πΎ Models - Define with
add_model - π§ͺ Test - Verify with
flutter test
βοΈ Configuration #
π Environment Setup #
StarterKit supports multiple environments:
| Environment | Purpose | Configuration |
|---|---|---|
| Development | Local testing | Debug logs, mock data |
| Staging | QA testing | Test APIs, monitoring |
| Production | Live app | Optimized, analytics |
π§ Build Commands #
# Development
flutter run --dart-define=ENV=development
# Staging
flutter build apk --dart-define=ENV=staging
# Production
flutter build apk --dart-define=ENV=production
π§ͺ Testing Strategy #
StarterKit generates a comprehensive testing structure:
π Test Types #
π¬ UNIT TESTS
βββ Business logic validation
βββ Utility function testing
βββ Repository method testing
π WIDGET TESTS
βββ UI component behavior
βββ User interaction testing
βββ Widget state management
π INTEGRATION TESTS
βββ Complete user flows
βββ API integration testing
βββ End-to-end scenarios
β‘ Running Tests #
flutter test # All tests
flutter test test/unit/ # Unit tests only
flutter test test/widget/ # Widget tests only
flutter test --coverage # With coverage report
π¨ Customization #
π¨ Theme Customization #
Override default colors:
class MyAppColors extends AppColors {
static const Color primary = Color(0xFF6366F1); // Custom primary
static const Color accent = Color(0xFF10B981); // Custom accent
}
Custom typography:
class MyTextStyles extends AppTextStyles {
static const TextStyle heroTitle = TextStyle(
fontSize: 48,
fontWeight: FontWeight.bold,
);
}
π§ Component Customization #
Create custom components:
class CustomButton extends StatelessWidget {
// Extend StarterKit components
// Add your custom styling
}
π€ Contributing #
π How to Contribute #
We welcome contributions to make StarterKit even better!
π Bug Reports
- Report issues with clear reproduction steps
- Include Flutter/Dart version information
- Provide minimal code examples
β¨ Feature Requests
- Suggest new CLI commands
- Propose new utility functions
- Request additional components
π Documentation
- Improve README sections
- Add code examples
- Create tutorials
π Development Setup #
# 1. Fork and clone
git clone https://github.com/your-username/starter_kit.git
# 2. Install dependencies
flutter pub get
# 3. Run tests
flutter test
# 4. Test CLI
dart run bin/starter_kit.dart init
Made with β€οΈ by ErrorXperts