Skip to content

[FR]: Use static const variables instead of getters for assets when using style: dot-delimiter #351

Open
@ndelanou

Description

@ndelanou

Is there an existing issue for this?

  • I have searched the existing issues

Describe the problem

When generating assets using style: dot-delimiter, I would like to be able to access the generated assets as constant values.
I found this previous issue (#185) but I would like to keep the dot-delimiter style.

Today, the generated code look like this:

SvgGenImage get icon => const SvgGenImage('assets/my-library-1/icon.svg');

So I cannot call it like this:

const icon = Assets.myLibrary1.icon;

This is preventing me from creating several const Widgets.

Describe the solution

The generated code could look like this:

static const icon = SvgGenImage('assets/my-library-1/icon.svg');

Additional context

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions