Features β’ Quick Start β’ Structure β’ Documentation
| Feature | Description |
|---|---|
| π± Platform Support | Android & iOS ready |
| ποΈ DDD Architecture | Clean, scalable code organization |
| π§ Freezed | Immutable models & unions |
| π― BLoC Pattern | Predictable state management |
| πΊοΈ AutoRoute | Type-safe navigation |
| π Multi-Flavor | Dev, Staging, Production environments |
| π Dependency Injection | Modular & testable |
| π Theme Support | Light, Dark, System modes |
| π§ Error Handling | Centralized failure management |
# Install copy_template globally
dart pub global activate copy_template
# Create your project
copy_template my_app https://github.com/yusriltakeuchi/flutter_template.git /path/to/folder# Change package name
dart run change_app_package_name:main com.your.package
# Update flavor names in:
# - android/app/build.gradle (productFlavors)
# - utils/flavor/flavor_utils.dartflutter run --flavor devAvailable flavors: dev | staging | prod
lib/
βββ π― bloc/ # State management
βββ βοΈ config/ # App configuration
βββ ποΈ core/ # Core utilities
β βββ components/ # Reusable widgets
β βββ constant/ # Constants
β βββ models/ # Core models
β βββ networks/ # API client
βββ π¨ domain/ # Business logic
β βββ cubit/ # Safe cubit base
β βββ dto/ # Data Transfer Objects
β βββ entities/ # Domain entities
β βββ models/ # Domain models
β βββ repositories/ # Repository interfaces
βββ β¨ extension/ # Dart extensions
βββ π§ infrastructure/ # Data layer
β βββ datasource/ # Data sources
β βββ repositories/ # Repository implementations
βββ π injection/ # Dependency injection
βββ π± presentation/ # UI screens
βββ πΊοΈ routing/ # Navigation
βββ π¨ theme/ # App themes
βββ π οΈ utils/ # Utilities
Create android/key.properties:
storePassword=yourpassword
keyPassword=yourpassword
keyAlias=youralias
storeFile=/path/to/key.jksThis template uses flutter_launcher_icons with flavor support.
# Generate for development flavor
flutter pub run flutter_launcher_icons:main -f flutter_launcher_icons.yaml
# Generate for staging flavor
flutter pub run flutter_launcher_icons:main -f flutter_launcher_icons-staging.yaml
# Generate for production flavor
flutter pub run flutter_launcher_icons:main -f flutter_launcher_icons-prod.yamlEdit icon configurations in:
flutter_launcher_icons.yaml- Development flavor iconsflutter_launcher_icons-staging.yaml- Staging flavor iconsflutter_launcher_icons-prod.yaml- Production flavor icons
flutter_launcher_icons:
android: true
ios: true
image_path: "assets/icons/your_icon.png"
# Add more customization as neededπ‘ Tip: Place your icon files in assets/icons/ directory and update the image_path in the config files.
- Create screen in
presentation/ - Add annotation:
@RoutePage() class HomeScreen extends StatelessWidget { // Your screen code }
- Generate routes:
make runner-build
- Register route in
route.dart:@override List<AutoRoute> get routes => [ AutoRoute(page: HomeRoute.page), ];
Access theme with BlocBuilder<ThemeBloc>. Modes: light, dark, system
Use BlocBuilder with Freezed's when or maybeWhen for clean state handling:
// Using .when() - Handle all states
BlocBuilder<UserBloc, UserState>(
builder: (context, state) {
return state.when(
initial: () => const IdleLoading(),
loading: () => const LoadingListView(),
error: (message) => ErrorWidget(message),
loaded: (data) => DataView(data),
);
},
)
// Using .maybeWhen() - Handle specific states only
BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, state) {
return state.maybeWhen(
loaded: (mode) => YourWidget(mode),
orElse: () => const CircularProgressIndicator(),
);
},
)Use context extensions for theme-aware colors:
// Auto-adapts to light/dark theme
Container(
color: context.containerColor,
child: Text(
'Hello',
style: TextStyle(color: context.blackWhiteColor),
),
)Available colors:
context.isDark- Check if dark mode is activecontext.blackWhiteColor- Black in light, white in darkcontext.containerColor- Card/container backgroundcontext.backgroundColor- Screen backgroundcontext.greyDarkColor- Grey text colors
flavor.current // Returns: dev, staging, or prodUse AppSetting for responsive dimensions across all devices:
// Font Size - automatically adapts to screen size
Text(
'Title',
style: TextStyle(fontSize: AppSetting.setFontSize(16)),
)
// Width & Height
Container(
width: AppSetting.setWidth(200),
height: AppSetting.setHeight(100),
)
// Device dimensions
AppSetting.deviceWidth // Full screen width
AppSetting.deviceHeight // Full screen height
// Quick spacing
Space.w(16) // Horizontal spacing
Space.h(20) // Vertical spacing
// Device checks
AppSetting.isLargePhone(context)
AppSetting.isTablet(context)domain/entitiesβ Entitydomain/dtoβ DTO with Freezed & JSON serializationinfrastructure/datasource/baseβ API Extensioninfrastructure/datasourceβ DataSourcedomain/repositoriesβ Repository Interfaceinfrastructure/repositoriesβ Repository Implementationinjectionβ Register Dependenciesblocβ Create BLoC/Cubitpresentationβ Build UI
Speed up development with pre-built templates for Entity, DTO, and BLoC.
π₯ Download Templates
Installation:
- Download template file
- IntelliJ β
FileβManage IDE SettingsβImport Settings - Select downloaded file
Clean unused assets from your Flutter project automatically.
Made with β€οΈ by Yusril Rapsanjani
β Star this repo if you find it helpful!

