devforge 1.3.0
devforge: ^1.3.0 copied to clipboard
CLI tool to generate Flutter/Dart boilerplate code.
devforge #
A powerful and flexible Command Line Interface (CLI) tool for generating common Flutter/Dart boilerplate code directly into your project. Stop writing the same utility files over and overβlet devforge handle the heavy lifting!
β¨ Features #
devforge offers both direct command execution and an interactive mode to quickly scaffold necessary services and utilities.
- ApiClient Service: Creates an
api_client.dartfile with dio API calling setup. - Assets Utility Generation: Creates an
assets_utils.dartfile with static paths for all resources in yourassetsfolder. - FCM Service Scaffold: Generates a standard
fcm_service.dartfor handling Firebase Cloud Messaging setup. - Refresh Token Service: Scaffolds a dedicated service for managing token refresh logic.
- Local Storage Service: Creates either
shared_preferences_service.dartorget_storage_service.dartto store data locally. - Sqflite Service: Creates an
sqflite_service.dartto store data locally. - Pagination Utilities: Creates both a
pagination_controller.dartand reusablepaging_list_view.dartandpaging_custom_scroll_view.dartwidgets. - Bloc Classes: Creates a basic bloc folder structure with
bloc.dart,state.dart, andevent.dartfiles with boilerplate code. - Getx Classes: Creates a basic getx folder structure with
controller.dart,bindings.dart, andscreen.dartfiles. - App Icon Generator: Generates app icons of different sizes for all supported platforms.
- Localization Utilities: Extracts string literals, generates locale keys, and translation files for multiple languages.
- Interactive Mode: Use the
devforge runcommand for a friendly menu-driven generation experience.
π Installation #
1. Activate the Package #
Activate devforge globally using the Dart package manager. This makes the devforge command available anywhere on your system.
dart pub global activate devforge
2. Verify Installation #
Run the help command to confirm devforge is installed and working correctly.
devforge --help
OR #
devforge -h
General Version #
To see the current installed version on your device:
devforge --version
OR #
devforge -v
π¨βπ» Usage #
There are two primary ways to use devforge: Direct Commands and the Interactive Run mode.
1. Interactive Mode (devforge run)
For generating multiple files at once or for a guided experience, use the run command.
devforge run
This will launch an interactive multi-select menu, allowing you to choose which services you want to generate.
? Select what you have to generate:
[ ] Generate ApiClient
[ ] Generate AssetsUtils
[ ] Generate FcmService
[ ] Generate RefreshToken service
[ ] Generate Local Storage Service
[ ] Generate SqfliteService
[ ] Generate Pagination Service
[ ] Generate BLoC folder
[ ] Generate Getx folder
[ ] Generate App icons
2. Direct Commands
Use these commands for quick, single-purpose generation.
| Command | Description | Output File(s) |
|---|---|---|
devforge api_client |
Generates a boilerplate service for handling API calls. | lib/api_client.dart, lib/logger_interceptor.dart |
devforge assets |
Scans the assets folder and generates the assets utility file. | lib/assets_utils.dart |
devforge fcm |
Generates a boilerplate service for handling FCM. | lib/fcm_service.dart |
devforge refresh |
Generates the service for managing refresh token logic. | lib/refresh_token.dart |
devforge local_storage |
Generates shared_preferences or get_storage service. | lib/shared_preferences_service.dart or lib/get_storage_service.dart |
devforge sqflite |
Generates a sqflite singleton service. | lib/sqflite_service.dart |
devforge pagination |
Generates a controller and reusable widgets for paginated lists. | lib/pagination_controller.dart, lib/paging_list_view.dart, lib/paging_custom_scroll_view.dart |
devforge bloc |
Generate bloc directory which contains bloc.dart, state.dart, and event.dart. | Folder with bloc files at your chosen path |
devforge getx |
Generate getx directory which contains controllers, bindings, and views. | Folder with getx files at your chosen path |
devforge app-icon |
Generate app icon of different sizes in platform specific folders. | Platform-specific icon folders |
devforge localize |
Extracts strings, generates locale keys, and translation files for localization. | lib/locale_keys.dart, lib/en.dart, etc. |
General Help #
To see the list of all available commands:
devforge --help
π οΈ Configuration #
You can set your name (used in generated file comments) using:
devforge config
Or update it interactively via the menu.
π Output Structure #
Generated files are placed in the lib/ directory or in a subfolder you specify. For folder-based generators (bloc/getx), you can choose the output path.
π License #
MIT License. See LICENSE for details.