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

Throw if annotation is placed on methods instead of static functions #74

Open
subzero911 opened this issue Sep 4, 2020 · 4 comments
Open
Labels
enhancement New feature or request

Comments

@subzero911
Copy link

subzero911 commented Sep 4, 2020

It simply does not working (nothing generates).

That's my steps:

  • added part 'checkup_results_screen.g.dart'; (not mentioned in docs but I guess it is needed)
  • annotated my methods with @swidget
    image
    I also tried to remove underscore and build word.
  • it's unclear from the docs if I must pass context into function or not (I tried both)
  • run the build_runner

My pubspec:
image
I also tried to put functional_widget into dev_dependencies

@rrousselGit
Copy link
Owner

rrousselGit commented Sep 4, 2020 via email

@subzero911
Copy link
Author

Yes, it actually does.
I think it's worth mentioning in the manual.
Because I broke all my head trying to understand the reason :)

@rrousselGit rrousselGit added the enhancement New feature or request label Sep 4, 2020
@rrousselGit
Copy link
Owner

I'll see if we can throw an error in that situation

@rrousselGit rrousselGit changed the title Not working Throw if annotation is placed on methods instead of static functions Dec 13, 2020
@menting311
Copy link

This finally helped solve my issue. I spent hours today trying to figure out why build_runner wouldn't find the files with @swidget in them. I looked in verbose output and the files with @swidget were not even being acted upon. I was using the annotation on a method in my class.

it wasn't clear from the docs that these methods should be moved outside of the class. If this warning cannot be accomplished in the build runner or annotation processing, it would be very helpful to spell this out in the docs.

If I missed it somewhere please show me where.
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants