functional_widget
functional_widget copied to clipboard
Throw if annotation is placed on methods instead of static functions
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
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:
I also tried to put
functional_widget
into dev_dependencies
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 [email protected] wrote:
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 https://github.com/Swidget [image: image] https://user-images.githubusercontent.com/12999702/92243117-9989bf00-eec9-11ea-8c97-9847e8829e00.png 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
— 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 .
Yes, it actually does. I think it's worth mentioning in the manual. Because I broke all my head trying to understand the reason :)
I'll see if we can throw an error in that situation
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.