-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[Code] should be string interpolated to the code string #57064
Comments
Summary: The user wants to use a string instead of an array to represent code in the |
The reason you cannot use a string interpolation is that it will eagerly create string at that point, and the macro processor doesn't know whether the reference will need an import prefix, or what it will be, until it has seen all the macro generated code. |
I see. Maybe there is the possibility for a string lookalike, such as
This may have been suggested elsewhere so I will close this as I just wanted to give my unimformed two cents. |
Currently using
Code
in an interpolated String will result inInstance of..
. In the context of macros, a more sensible option would be to overrideCode.toString()
so string interpolatation returns a string that represents the actual code.Use case:
Using strings is more readable than arrays in some cases. I wanted to do
but had to do:
In place like here https://github.com/dart-lang/sdk/pull/57063/files#diff-e10def922b15028782e7fdcf395c5acab6f0cc2e86c1696a3e936eb775396d7aR638
The text was updated successfully, but these errors were encountered: