devforge 1.3.1
devforge: ^1.3.1 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!
DevForge works best inside a Flutter/Dart app and focuses on scaffolding production-ready services (API client, FCM, storage, pagination, BLoC, GetX, app icons, etc.) via a simple CLI.
β¨ 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-based API calling setup plus alogger_interceptor.dart. - 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
refresh_token.dartservice for managing token refresh logic. - Local Storage Service: Creates either
SharedPreferencesServiceorGetStorageServiceto store data locally. - Sqflite Service: Creates a
sqflite_service.dartto store data locally usingsqflite. - Pagination Utilities: Creates a
pagination_controller.dartand reusablepaging_list_view.dart/paging_custom_scroll_view.dartwidgets. - BLoC Boilerplate: Creates a basic BLoC folder structure with
bloc.dart,state.dart, andevent.dartfiles. - GetX Boilerplate: 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.
- Interactive Mode: Use the
devforge runcommand for a friendly, menu-driven generation experience.
Note: Localization-related generators exist in the codebase, but there is currently no stable
devforge localizeCLI command wired up. This may change in a future release.
π Requirements #
- Dart SDK:
>=3.0.0 <4.0.0 - A Flutter/Dart project where generated files will be placed (usually under
lib/). - Make sure your global pub bin directory (e.g.
~/.pub-cache/bin) is in yourPATH.
π 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
3. Check the installed version #
devforge --version
or:
devforge -v
π¨βπ» Usage #
There are two primary ways to use DevForge: interactive mode and direct commands.
1. Interactive mode (devforge run) #
For generating multiple files at once or for a guided experience, use the run command:
devforge run
This launches an interactive multi-select menu and lets you 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) / effect |
|---|---|---|
devforge generate_config |
Generates a devforge.yaml configuration file in the current project. |
devforge.yaml in the project root |
devforge userInfo |
Opens an interactive prompt to update your stored name (used in generated file comments). | Updates user name stored in DevForge config |
devforge show_user_name |
Prints your currently saved user name. | Outputs the saved name in the terminal |
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 |
Interactively chooses and generates either 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 |
Generates a BLoC directory with bloc.dart, state.dart, and event.dart. |
BLoC folder (path chosen interactively) |
devforge getx |
Generates a GetX directory with controllers, bindings, and views. | GetX folder (path chosen interactively) |
devforge app-icon |
Generates app icons of different sizes in platform-specific folders. | Platform-specific icon assets |
If you pass --help with no command, youβll see the full list of supported commands.
π οΈ Configuration #
DevForge stores your author name and can also generate a project-level configuration file.
- On first run, DevForge will prompt you for your name (used in generated file comments).
- You can update it later with:
devforge userInfo
- To see your currently saved name:
devforge show_user_name
- To generate or regenerate the main configuration file in your project:
devforge generate_config
This creates a devforge.yaml file in the current directory, which you can customize to tweak how generators behave.
π Output structure #
Generated files are placed in the lib/ directory or in a subfolder you specify:
- Service files (API client, FCM, storage, sqflite, pagination) are created directly under
lib/by default. - For folder-based generators (BLoC / GetX), you can choose the target path where the new directory and files will be created.
- App icons are generated in platform-specific asset folders (e.g. Android/iOS).
π§βπ» Development #
If you want to work on DevForge itself:
-
Clone the repository:
git clone https://github.com/prathamesh-mali/devforge.git cd devforge -
Fetch dependencies:
dart pub get -
Run the CLI locally:
dart run bin/devforge.dart --help -
Run tests:
dart test
π License #
MIT License. See LICENSE for details.