Skip to content

Flutter_structure_generator automatically builds, modifies, and deletes the folder/file structure of a Flutter project using the MVVM pattern. πŸš€

License

Notifications You must be signed in to change notification settings

myaasiinh/flusgen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

22 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

FlusGen

flusgen is a tool that helps you automatically generate folder and file structures for Flutter projects using the MVVM (Model-View-ViewModel) architecture pattern or Other. With this tool, you can quickly create predefined folders and files, as well as perform operations such as creating custom folders/files, renaming them, and deleting them.


Screenshoot Flusgen

Image


Demo Test Flusgen

test_demo_flusgen.mp4

πŸ“Œ Project Description

This project is designed to simplify the setup of folder and file structures in Flutter projects. Using this tool, you can generate consistent folder and file structures following a specific architecture pattern (such as MVVM or Other). Additionally, you can customize the existing structure by adding, renaming, or deleting folders and files.


✨ Key Features

  • βœ… Generate Structure: Automatically create a default folder and file structure based on predefined templates.
  • βœ… Generate from File: Create a custom folder and file structure based on a .json file.
  • βœ… Create Custom Folder: Add custom folders after generating the default structure.
  • βœ… Rename Folder: Rename existing folders within the project structure.
  • βœ… Delete Folder: Remove folders from the project structure.
  • βœ… Create Custom File: Add custom files within the project structure.
  • βœ… Rename File: Rename existing files within the project structure.
  • βœ… Delete File: Remove files from the project structure.

πŸš€ Installation

1️⃣ Install FlusGen

Run the following command in Command Prompt (CMD) to activate the package:

dart pub global activate flusgen

2️⃣ Configure PATH

To run commands globally, add the following directory to your PATH environment variable:

C:\Users\myaasiinh\AppData\Local\Pub\Cache\bin

Steps to Add PATH on Windows

  1. Open Environment Variables:

    • Press Win + S and search for "Environment Variables".
    • Click Edit the system environment variables.
    • In the System Properties window, click Environment Variables.
  2. Add PATH:

    • Under System Variables, find the variable named Path and click Edit.
    • Click New, then enter:
      C:\Users\myaasiinh\AppData\Local\Pub\Cache\bin
      
    • Click OK to save changes.
  3. Restart Terminal or IDE:

    • Close the terminal (Command Prompt, PowerShell, or VS Code terminal) and reopen it to apply the configuration.

πŸ›  Available Commands

πŸ”Ή 1. Generate Default Structure

Generates the default folder and file structure:

flusgen generate-structure

πŸ”Ή 2. Create Custom Folder

Creates a custom folder after the default structure (Replace <folderPath> with the desired folder path):

flusgen create-custom-folder <folderPath>

πŸ“Œ Example:

flusgen create-custom-folder lib/features/authentication

πŸ”Ή 3. Rename Folder

Renames an existing folder:

flusgen rename-folder <oldPath> <newPath>

πŸ“Œ Example:

flusgen rename-folder lib/features/authentication lib/features/login

πŸ”Ή 4. Delete Folder

Removes a folder from the project structure:

flusgen delete-folder <folderPath>

πŸ“Œ Example:

flusgen delete-folder lib/features/login

πŸ”Ή 5. Create Custom File

Creates a custom file inside a specific folder:

flusgen create-custom-file <filePath> [content]

πŸ“Œ Example:

flusgen create-custom-file lib/features/authentication/auth_service.dart

πŸ”Ή 6. Rename File

Renames a file within the project structure:

flusgen rename-file <oldPath> <newPath>

πŸ“Œ Example:

flusgen rename-file lib/features/authentication/auth_service.dart lib/features/authentication/login_service.dart

πŸ”Ή 7. Delete File

Deletes a file from the project structure:

flusgen delete-file <filePath>

πŸ“Œ Example:

flusgen delete-file lib/features/authentication/auth_service.dart

πŸ”Ή 8. Generate Structure from a File

Generates a folder and file structure based on a .json file, allowing for customization without relying on built-in templates.

flusgen generate-structure-from-json <filePath>

πŸ“Œ Example:

flusgen generate-structure-from-json structure.json lib

πŸ“„ File Format (.json)

{
  "lib": {
    "core": {
      "config": ["main_app.dart"],
      "global_component": ["global_widget.dart"],
      "constants": ["string.dart", "color.dart", "images.dart"],
      "utils": ["route_utils.dart"]
    },
    "data": {
      "data1": {
        "requests_model": ["data1_requests_model.dart"],
        "responses_model": ["data1_responses_model.dart"],
        "datasource": ["data1_data_source.dart"],
        "repository": ["data1_repository.dart"],
        "viewdatamodel": ["data1_view_datamodel.dart"]
      }
    },
    "features": {
      "features1": {
        "": ["features_screen.dart"],
        "widget": ["features1_widget.dart"],
        "controller": ["features_controller.dart"]
      }
    }
  }
}

🎯 Use Cases

βœ… 1. Generate Default Structure

Create a default folder and file structure:

flusgen generate-structure

βœ… 2. Create Custom Folder

Add a custom folder to the generated structure:

flusgen create-custom-folder lib/features/authentication

βœ… 3. Rename Folder

Rename the authentication folder to login:

flusgen rename-folder lib/features/authentication lib/features/login

βœ… 4. Delete Folder

Remove an unnecessary folder:

flusgen delete-folder lib/features/login

βœ… 5. Create Custom File

Add a custom file to the project structure:

flusgen create-custom-file lib/features/authentication/auth_service.dart

βœ… 6. Rename File

Rename auth_service.dart to login_service.dart:

flusgen rename-file lib/features/authentication/auth_service.dart lib/features/authentication/login_service.dart

βœ… 7. Delete File

Remove an unused file:

flusgen delete-file lib/features/authentication/auth_service.dart

βœ… 8. Generate Structure from a File

Generate a custom folder and file structure from a .json file:

flusgen generate-structure-from-json structure.json lib

🀝 Contributing

If you would like to contribute to this project, feel free to submit a pull request. Follow these steps:

  1. Fork this repository.
  2. Create a new branch for your changes.
  3. Make your changes and ensure your code runs properly.
  4. Submit a pull request to merge your changes.

πŸ“œ License

This project is licensed under the MIT License.


πŸŽ‰ Enjoy using flusgen! If you have any questions, feel free to ask! πŸš€


🚧 Maintainer

GitHub
Ko-fi

About

Flutter_structure_generator automatically builds, modifies, and deletes the folder/file structure of a Flutter project using the MVVM pattern. πŸš€

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages