smart_asset_generator 0.2.0
smart_asset_generator: ^0.2.0 copied to clipboard
A Dart/Flutter CLI toolkit for generating asset references, barrel files, GetX modules, and GitLab PR checker scaffolding.
π οΈ Smart Asset Generator #
A powerful and flexible Dart/Flutter CLI tool to auto-generate asset reference classes, barrel files, and GetX module scaffolding β making asset management and project structure consistent, clean, and fast.
β¨ Features #
β
Automatically scans folders and generates asset reference classes (AppImages, etc.)
β
Converts file names to camelCase constants
β
Supports nested folders and all file types
β
Barrel file generator to export Dart files from any directory
β
Modular code generator for GetX (controller, binding, view)
β
Project cloning with custom Android/iOS package names and optional path
β
GitLab MR checker scaffold for GetX conventions
β
CLI-ready with clean syntax
β
Fully customizable output structure
β
Works in Flutter and pure Dart projects
β
Build Android APK / iOS IPA and upload to Loadly (Diawi alternative)
β
One command to build both APK and IPA with install links printed
π¦ Use Cases #
- Generate
AppImagesclass to avoid hardcoded asset strings - Create
exports.dartbarrel file to group exports cleanly - Scaffold complete module (binding/controller/view) with a single command
- Clone a Flutter project with new app name and package IDs
- Keep your imports scalable and clean in large projects
π Installation #
In your Flutter/Dart projectβs pubspec.yaml:
dev_dependencies:
smart_asset_generator: <latest_version>
Then run:
flutter pub get
π CLI Usage #
Run using:
dart run smart_asset_generator <command> [arguments]
πΉ Commands Overview #
| Command | Description |
|---|---|
asset |
Generate Dart class with asset paths |
barrel |
Generate a barrel file that exports Dart files |
module |
Create a module with controller, binding, and view files |
clone |
Clone the entire project with new package identifiers |
apk |
Build APK and upload to Loadly (Diawi alternative) |
ipa |
Build IPA (macOS only) and upload to Loadly |
apps |
Build both APK and IPA and upload to Loadly |
init |
Create smart_asset_generator.yaml to save API key |
prchecker |
Scaffold .gitlab/pr_checker.py for MR validations |
πΌοΈ Generate Asset Class #
dart run smart_asset_generator asset <asset_path> [class_name]
| Argument | Required | Description |
|---|---|---|
asset_path |
β | Path to folder containing asset files |
class_name |
β | Class name (default: AppAssets) |
β Example
dart run smart_asset_generator asset assets/images AppImages
Output:
lib/generated/app_images.dart
π¦ Generate Barrel File #
dart run smart_asset_generator barrel <directory_path> [output_file_name]
| Argument | Required | Description |
|---|---|---|
directory_path |
β | Folder to scan for .dart files |
output_file_name |
β | Output file name (default: exports.dart) |
β Example
dart run smart_asset_generator barrel lib/widgets widget_exports
Output:
lib/widgets/widget_exports.dart
π§± Generate Module (GetX structure) #
dart run smart_asset_generator module name=<module_name> location=<path> [export=<barrel_file_path>]
| Argument | Required | Description |
|---|---|---|
name |
β | Module name (home, profile, etc.) |
location |
β | Where to create the module (e.g., lib/modules) |
export |
β | Optional barrel file path to append exports to |
β Example
dart run smart_asset_generator module name=home location=lib/modules
Creates:
lib/modules/home/
βββ bindings/home_binding.dart
βββ controller/home_controller.dart
βββ view/home_page.dart
Also appends exports to:
lib/modules/exports.dart
You can override export file:
dart run smart_asset_generator module name=login location=lib/ui export=lib/ui/index.dart
π Clone Existing Project #
dart run smart_asset_generator clone name=<new_project_name> android=<android_package> ios=<ios_package> [path=<directory_path>]
| Argument | Required | Description |
|---|---|---|
name |
β | New Flutter project name in snake_case |
android |
β | New Android package name (e.g., com.my.app) |
ios |
β | New iOS bundle identifier (e.g., com.my.app) |
path |
β | Optional path where the new project will be created (default: parent folder) |
β Example
dart run smart_asset_generator clone name=new_app android=com.new.android ios=com.new.ios path=/Users/you/FlutterProjects
Performs:
- Duplicates current project folder to the specified path (or the parent folder if
pathis not provided) - Updates:
pubspec.yamlproject name- Android:
applicationIdinbuild.gradle,AndroidManifest.xml,.imlfiles - iOS:
CFBundleIdentifierinInfo.plist - Renames root
.imland Android module.imlfiles - Replaces package names and project references in all source files
- Ensures the cloned project is ready to open and run independently
βοΈ Build APK and Upload to Loadly #
dart run smart_asset_generator apk [release|debug] apiKey=<YOUR_API_KEY> [buildInstallType=1|2|3] [buildPassword=<pwd>] [desc=<notes>]
| Argument | Required | Description |
|---|---|---|
| `release | debug` | β |
apiKey |
β | Loadly API key (_api_key) |
buildInstallType |
β | 1: public, 2: password, 3: invitation (default: 1) |
buildPassword |
β | Password if buildInstallType=2 |
desc |
β | Update description |
β Example
dart run smart_asset_generator apk release apiKey=YOUR_KEY buildInstallType=1 desc="Initial release"
On success, the tool prints the install page URL, shortcut URL (if any), and build key returned by Loadly.
π Build IPA and Upload to Loadly (macOS only) #
dart run smart_asset_generator ipa [apiKey=<YOUR_API_KEY>] [buildInstallType=1|2|3] [buildPassword=<pwd>] [desc=<notes>]
| Argument | Required | Description |
|---|---|---|
apiKey |
β | Loadly API key (omit if saved via init file) |
buildInstallType |
β | 1: public, 2: password, 3: invitation (default: 1) |
buildPassword |
β | Password if buildInstallType=2 |
desc |
β | Update description |
β Example
dart run smart_asset_generator ipa apiKey=YOUR_KEY buildInstallType=1 desc="iOS test build"
Note: Requires macOS with iOS signing configured in Xcode.
π Build Both: APK + IPA (with links) #
dart run smart_asset_generator apps [release|debug] [apiKey=<YOUR_API_KEY>] [buildInstallType=1|2|3] [buildPassword=<pwd>] [desc=<notes>]
| Argument | Required | Description |
|---|---|---|
| `release | debug` | β |
apiKey |
β | Loadly API key (omit if saved via init file) |
buildInstallType |
β | 1: public, 2: password, 3: invitation (default: 1) |
buildPassword |
β | Password if buildInstallType=2 |
desc |
β | Update description |
β Example
dart run smart_asset_generator apps release apiKey=YOUR_KEY desc="Weekly QA build"
The command prints separate APK and IPA install links from Loadly.
π§° One-time Init (optional) #
Create a project config file to store your Loadly API key and see handy example commands:
dart run smart_asset_generator init
This creates smart_asset_generator.yaml. Add your API key under:
loadlyApiKey: "YOUR_KEY"
You can still pass apiKey=YOUR_KEY inline to any command if you prefer.
You can visit this website to create apiKey https://loadly.io/doc/view/api
π‘οΈ GitLab PR Checker & Quality Dashboard #
Transform your Merge Requests into a professional quality gate. This tool generates a stakeholder-friendly dashboard that reviews code security, architecture, and best practices.
π What it does:
- Executive Scorecard: A high-level health score for PMs and Clients.
- Categorized Business Impact: Issues are grouped by Security, Architecture, and Quality.
- Direct Developer Feedback: Expandable technical details with file/line numbers for developers.
- Automated Emails: Beautiful, branded email reports sent to your team.
π Quick Setup
# Basic setup
dart run smart_asset_generator prchecker label="Ashraf Rewamp"
# Update an existing checker
dart run smart_asset_generator prchecker label="Ashraf Rewamp" overwrite=true
| Argument | Required | Description |
|---|---|---|
label |
β | Branded project name used in dashboard & emails (e.g. "Ashraf Rewamp") |
token |
β | Personal Access Token fallback (Not recommended; use CI variables instead) |
overwrite |
β | Set to true to update the script with the latest UI features |
π Secure Email Management
For maximum security and ease of management, email recipients are controlled centrally via GitLab. Developers cannot change who receives these reports in the source code.
- Go to GitLab Dashboard: Navigate to Settings > CI/CD > Variables.
- Add Management Emails:
- Key:
PR_CHECKER_EMAILS - Value:
manager@company.com, client@domain.com(comma-separated).
- Key:
π Required CI/CD Variables
To enable the full Dashboard and Email features, add these 4 variables in your GitLab Project Settings > CI/CD > Variables:
GITLAB_TOKEN: A Personal Access Token withapiscope (Enable Masked).PR_CHECKER_EMAILS: Comma-separated list of recipients (e.g.,pm@co.com, client@co.com).SMTP_USER: Your sender email (e.g.,reports@yourcompany.com).SMTP_PASSWORD: Your App Password (See below how to generate).
οΏ½ How to get a Gmail App Password
If you are using Gmail, your regular password will not work. You must generate an "App Password":
- Go to your Google Account Settings.
- Navigate to Security.
- Under "How you sign in to Google," ensure 2-Step Verification is ON.
- Click on 2-Step Verification, then scroll to the bottom and click App Passwords.
- Enter a name (e.g., "GitLab PR Checker") and click Create.
- Copy the 16-character code and paste it as your
SMTP_PASSWORDin GitLab.
Note: This setup is "set and forget." Once configured in GitLab, every new Merge Request will automatically generate a professional quality report.
ποΈ Output Summary #
| Command | Output Location |
|---|---|
asset |
lib/generated/{class_name}.dart |
barrel |
{directory}/{output_file_name}.dart |
module |
{location}/{name}/... + exports to barrel file |
clone |
{path}/{new_project_name}/ |
apk |
build/app/outputs/flutter-apk/ (auto-renamed APK) |
ipa |
build/ios/ipa/ (auto-renamed IPA) |
apps |
APK: build/app/outputs/flutter-apk/, IPA: build/ios/ipa/; prints Loadly links |
π License #
MIT License
Β© 2025 Divyarajsinh Jadeja
π Contributions #
Pull requests, issues, and suggestions are welcome!
If this tool saves you time, please β star the repo and share it with your team!