smart_asset_generator 0.0.1 copy "smart_asset_generator: ^0.0.1" to clipboard
smart_asset_generator: ^0.0.1 copied to clipboard

A Dart package to generate Dart asset references with camelCase naming from your assets folder.

# ๐Ÿ› ๏ธ Asset Generator

[![pub package](https://img.shields.io/pub/v/asset_generator.svg)](https://pub.dev/packages/asset_generator)
[![GitHub license](https://img.shields.io/github/license/your-username/asset_generator)](https://github.com/your-username/asset_generator/blob/main/LICENSE)

A simple and flexible Dart/Flutter CLI tool to auto-generate asset reference classes like `AppImages`, `AppLottie`, or `AppLocales` from your project directories โ€” no more hardcoding asset paths or boilerplate maintenance!

---

## โœจ Features

โœ… Automatically scans asset folders and generates a Dart class with constant paths  
โœ… Supports nested directories and multiple asset types (`.svg`, `.png`, `.json`, etc.)  
โœ… CamelCase variable naming: `assets/images/ic_home.svg` โ†’ `icHome`  
โœ… Works with Flutter and pure Dart projects  
โœ… Fully customizable class name  
โœ… Ready to use from CLI or programmatically  

---

## ๐Ÿš€ Getting Started

### ๐Ÿ”ง Installation

Add this package to your `dev_dependencies`:

```yaml
dev_dependencies:
  asset_generator: ^1.0.0

Or use the path version locally during development:

dev_dependencies:
  asset_generator:
    path: ../asset_generator

Run pub get or flutter pub get.


๐Ÿƒโ€โ™‚๏ธ Usage #

๐Ÿ“ฆ From CLI

Run the generator with:

dart run asset_generator <asset_path> [class_name]
  • asset_path โ†’ Required. Path to your asset directory (e.g. assets/images)
  • class_name โ†’ Optional. Name of the generated Dart class (default: AppAssets)

๐Ÿ’ก Example

dart run asset_generator assets/images AppImages

Generates a Dart file like:

class AppImages {
  AppImages._();

  static const String icGoogle = 'assets/images/ic_google.png';
  static const String icArrowRight = 'assets/images/ic_arrow_right.svg';
}

You can now use it like:

Image.asset(AppImages.icGoogle);

๐Ÿ›  Output Location #

The generated file will be created in your project at:

lib/generated/AppImages.dart

Make sure lib/generated/ is included in your pubspec.yaml:

flutter:
  assets:
    - assets/images/

๐Ÿ“Œ Notes #

  • Ignores files like .DS_Store
  • Supports all file extensions
  • Converts snake_case file names into camelCase Dart variables
  • Does not require changes to your pubspec.yaml beyond asset inclusion

๐Ÿงช Example Project #

Want a working example? Check out the example/ folder included in the repo.


๐Ÿ“„ License #

MIT License Copyright ยฉ 2025 [Your Name]


โค๏ธ Contributions Welcome #

If you find a bug or want to add a feature, feel free to open an issue or PR. Star โญ the repo if you find it helpful!


---

Let me know if you want me to:

- Add GitHub links (replace `your-username` with your actual one)
- Auto-generate `LICENSE`, `CHANGELOG.md`, `pubspec.yaml`, or folder structure

Would you like me to do that as a zipped template?
6
likes
0
points
260
downloads

Publisher

verified publisherquantumeye.in

Weekly Downloads

A Dart package to generate Dart asset references with camelCase naming from your assets folder.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on smart_asset_generator