Image Enum List Generator

The Image Enum List Generator isis a command-line tool that provides functionality for organizing image files into Dart enum-like classes. It simplifies the process of managing image assets in Flutter projects by automatically generating enum-like classes based on the image files in a specified directory.

Features

  • Automatically generates Dart enum-like classes from image files.
  • Configurable settings for specifying the source directory,file extensions, class naming, and more.
  • Supports recursive scanning of directories for image files.
  • CLI (Command Line Interface) tool for easy integration into Flutter projects.
  • Watch mode for continuous monitoring and updating of generated files when changes occur.

Getting Started

  1. This package is intended to support development of Dart projects. In general, put it under dependencies, in your pubspec.yaml:
dependencies:
  image_enum_list_generator: ^0.0.1

2.You can install packages from the command line:

pub get

3.Create a new configuration file called image_enum_list_generator.yaml in the project's root directory

# The organizer recursively looks into all files in the `asset_folder_path` (relative to the project's root)
asset_folder_path: assets/images

# The folder where the generated enum-like classes will be placed
class_folder_path: lib/generated/image_enum_list/

# Indicates whether the organizer should recursively search for files within subdirectories
recursive: true

# Only files with extensions listed in `file_extensions` will be organized
file_extensions:
  - .jpg
  - .png
  - .svg

# The name of the custom enum-like class to be generated
custom_class_name: "ImageENUMList"
  1. Run the plugin in the project's root directory. See Available CLI Commands
dart run image_enum_list_generator:main <command>

Note that this plugin can be installed globally by dart pub global activate image_enum_list_generator. Instead of typing a long command shown above, you can run it by just imgres.

If you encounter an issue indicating dart: command not found, please install Dart separately first and try running again.

Available CLI Commands


commands:
[blank]:    Run this plugin once
run:        Run this plugin once
watch:      Run this plugin and watch for changes

Usage

If the plugin was installed globally, run it by:

image_enum_list_generator <command>

If the plugin was installed locally in a Flutter project, run it by:

dart run image_enum_list_generator:main <command>

Contributing

Contributions to Geosort are welcome! Please feel free to submit issues for any bugs or feature requests, and pull requests are encouraged.

License

GeoSort is available under the MIT license. See the LICENSE file for more info.

Libraries

image_enum_list_generator
A library for generating enum-like classes from image assets.