dartgenx 1.0.0
dartgenx: ^1.0.0 copied to clipboard
CLI tool to generate Flutter/Dart boilerplate code.
dartgen #
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 dartgen handle the heavy lifting!
β¨ Features #
dartgen offers both direct command execution and an interactive mode to quickly scaffold necessary services and utilities.
- 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.
- Pagination Utilities: Creates both a
pagination_controller.dartand a reusablepaging_list_view.dartwidget. - Interactive Mode: Use the
dartgen runcommand for a friendly menu-driven generation experience.
π Installation #
1. Activate the Package #
Activate dartgen globally using the Dart package manager. This makes the dartgen command available anywhere on your system.
dart pub global activate dartgen
2. Verify Installation #
Run the help command to confirm dartgen is installed and working correctly.
dartgen --help
π¨βπ» Usage #
There are two primary ways to use dartgen: Direct Commands and the Interactive Run mode.
1. Interactive Mode (dartgen run)
For generating multiple files at once or for a guided experience, use the run command.
dartgenx 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 AssetsUtils [ ] Generate FcmService [ ] Generate RefreshToken service [ ] Generate Pagination Service
2. Direct Commands
Use these commands for quick, single-purpose generation.
| Command | Description | Output File(s) |
|---|---|---|
| dartgenx assets | Scans the assets folder and generates the assets utility file. | lib/assets_utils.dart |
| dartgenx fcm | Generates a boilerplate service for handling FCM. | lib/fcm_service.dart |
| dartgenx refresh | Generates the service for managing refresh token logic. | lib/refresh_token_service.dart |
| dartgenx pagination | Generates a controller and a reusable widget for paginated lists. | "lib/pagination_controller.dart |
lib/paging_list_view.dart"
General Help #
To see the list of all available commands:
dartgenx --help
OR #
dartgenx -h