Closed exaby73 closed 5 months ago
Indeed, there is a mixin for StatefulWidgets and a WatchingStatefulWidget see https://github.com/escamoteur/watch_it#the-watchingwidgets but I agree that I could add a sentence of using the WatchItStatefulWidget
Btw I'm thinking ob adding an executeOnce
function
executeOnce
would be really good. It would help with eliminating the need for StatefulWidget
s altogether
I noticed in the docs that there is no use of
StatefulWidgets
, which makes sense. So without access toinitState
, how do I run code only once on first build?More broadly, are there any plans to support lifecycle hooks, like
initState
,dispose
, etc.?Side note: I usually use
flutter_hooks
for this, with an empty dependency array passed touseEffect
but seemswatch_it
is not compatible withHookWidget
Edit: I see that there are widgets and mixins for
StatefulWidget
as well. Maybe this should be documented. While this solves my issue, I think I'll keep this issue open for discussion on docs. Thanks