You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
Description
Sometimes, it is useful to resources between the
pre_gen
andpost_gen
hook. Say for example, you perform an expensive computation in thepre_gen
hook to derive some variables to be used by your template, and would like to reuse the output of such expensive computation in thepost_gen
hook.This is already possible by defining a variable in the
pre_gen
hook context, to be later consumed by thepost_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 isMap<String, dynamic>
.Additional Context
_my_var
(leading_
) might help avoid exposing new variables unnecessarily.The text was updated successfully, but these errors were encountered: