rrousselGit / functional_widget

A code generator to write widgets as function without loosing the benefits of classes.
596 stars 46 forks source link

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

Open subzero911 opened 4 years ago

subzero911 commented 4 years ago

It simply does not working (nothing generates).

That's my steps:

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

rrousselGit commented 4 years ago

From your screen shot, it appears that you decorated a method instead of a top-level function

Move the decorated method outside of the class and it should work

On Fri, Sep 4, 2020, 15:14 Sergey Molchanovsky notifications@github.com wrote:

It simply does not working (nothing generates).

That's my steps:

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rrousselGit/functional_widget/issues/74, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEZ3I3JUEZJTCXBWOALO2H3SEDR43ANCNFSM4QYKVRTA .

subzero911 commented 4 years ago

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 commented 4 years ago

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

menting311 commented 8 months ago

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.