Replies: 3 comments 2 replies
-
Sounds about right. Why can't you just do that directly?
You probably shouldn't have any other methods in the |
Beta Was this translation helpful? Give feedback.
-
Because I need to use in the listener an object obtained via capsule and I cannot pass this object to the listener as argument because the listener signature must be |
Beta Was this translation helpful? Give feedback.
-
I think I can use inheritance (extending classes) defining the build method in the parent class and implementing abstract builder (Widget) methods in the leaf classes. With also other util abstract methods like I will dig into to find the best approach for me but also following your best practices. No more questions for today. Thanks ;) |
Beta Was this translation helpful? Give feedback.
-
Scenario: I want to subscribe to a
ChangeNotifier
oncallonce
and unsubscribe ondispose
(effect
).Solution I: Declare the listener as a class method. This way I need to declare a late final class field that the listener needs to call. So I need to initialize this field (with
callonce
anduse.call
). I don't like too much this solution. This way I can easily un/susbcribe the listener (toGoRouter
).Solution II: Create an internal listener using
use.value(() {})
. Seems weird to do that, but should work.What approach will you use?
Also I want to know if it is feasible to have
WidgetHandle
available in all class methods, not just inbuild()
Beta Was this translation helpful? Give feedback.
All reactions