BirjuVachhani / spider

A small dart library to generate Assets dart code from assets folder.
https://spider.birju.dev/
Apache License 2.0
190 stars 19 forks source link

Add Flavor-Based Assets Support to Spider Package for Flutter #79

Open mg3994 opened 4 months ago

mg3994 commented 4 months ago

I would like to propose an enhancement to the Spider package for Flutter, introducing support for flavor-based assets. Currently, Flutter supports flavoring, allowing developers to build different versions of their app with variations in configurations, such as API endpoints, app icons, and more. However, there's a lack of direct support in Spider for managing assets based on these flavors.

Proposal: Integrate functionality into Spider to enable developers to specify assets based on different flavors defined in their Flutter projects.

Use Case: Consider a scenario where an app offers both a free and premium version. Each version may have its own set of assets, such as images, fonts, or configuration files. With flavor-based assets support in Spider, developers could organize their assets more efficiently, making it easier to manage and build multiple versions of their app.

Example:

# Reference :- https://docs.flutter.dev/deployment/flavors
assets:
    - assets/common/
    - path: assets/free/
      flavors:
        - free
    - path: assets/premium/
      flavors:
        - premium

In this example, assets are categorized based on the free and premium flavors. When building the app for each flavor, Spider would automatically include the respective assets, streamlining the development process.

Benefits:

Simplifies asset management for flavor-specific builds. Enhances code organization and maintainability. Enables smoother development workflows for apps with multiple flavors. Implementation Details:

Introduce a mechanism in Spider to parse flavor-specific asset configurations from the pubspec.yaml file. Modify Spider's asset handling logic to include assets based on the active flavor during the build process. I believe this enhancement would be valuable for Flutter developers utilizing Spider, providing greater flexibility and efficiency in managing assets across different app flavors.

Thank you for considering this feature request. I'm open to discussing further details and collaborating on its implementation.