Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: hook resource sharing #1256

Open
alestiago opened this issue Feb 21, 2024 · 0 comments
Open

feat: hook resource sharing #1256

alestiago opened this issue Feb 21, 2024 · 0 comments
Labels
enhancement candidate Candidate for enhancement but additional research is needed feedback wanted Looking for feedback from the community

Comments

@alestiago
Copy link
Collaborator

Description

Sometimes, it is useful to resources between the pre_gen and post_gen hook. Say for example, you perform an expensive computation in the pre_gen hook to derive some variables to be used by your template, and would like to reuse the output of such expensive computation in the post_gen hook.

This is already possible by defining a variable in the pre_gen hook context, to be later consumed by the post_gen hook. However, this exposes a new variable in the template unnecessarily. In addition, there is some casting to do since the hook context variables type is Map<String, dynamic>.

Additional Context

  • Private variables, like _my_var(leading _) might help avoid exposing new variables unnecessarily.
@felangel felangel added feedback wanted Looking for feedback from the community enhancement candidate Candidate for enhancement but additional research is needed labels Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement candidate Candidate for enhancement but additional research is needed feedback wanted Looking for feedback from the community
Projects
None yet
Development

No branches or pull requests

2 participants