-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Using Listenables in stateful widgets often has a lot of boilerplate, see example in https://gist.github.com/goderbauer/b82efcb154c3fe1814a0d0b60d277def:
- listener is added in
initState
- listener is moved to new object in
didUpdateWidget
- listener is removed in
dispose
- (often) a method calling an empty
setState
is needed
We discussed this use case in our initial brainstorm and I am now curious if we could reduce this boilerplate using this macro prototype.
When I experimented with this, I often got stuck wanting to put a macro on the controller
field in the StatefulWidget, which would then generate the required logic in the initState
, didUpdateWidget
, and dispose
methods of the associated State class. However, having the macro on a field affect methods in another class isn't possible. :)
Opening this issue to discuss other ideas for how this boilerplate can be reduced with macros.
Metadata
Metadata
Assignees
Labels
No labels