Closed caneva20 closed 3 years ago
how are these callbacks different from initState and dispose of the App
?
Same question as @nt4f04uNd.
This is not the responsibility of the Phoenix widget to init or dispose your App
.
You can use initState
and dispose
method of your App
for this.
Hmm... It seems I was overthinking when I proposed this. I now see that this doesn't make sense. At the time I had Phoenix
wrapping a MaterialApp
without a direct child (using routes only). In this scenario I couldn't use MaterialApp to do setup/disposed, but I didn't realize I could just wrap MaterialApp with another widget and achieve the same thing this PR "solves". It was just dumb of me submitting this, should've thought further.
Sorry :)
Hello @MrLepage.
This PR adds two callbacks that can be used as a sort of life cycle hook, a
setup
that is called when the starts or is restarted, and another one that is called just before "resetting" the app. I've added those because my app needs those hooks and I thought it would be a good addition to the plugin. I've also updated the README to explain a bit how to use them.Feel free to ask for any changes if you judge necessary, or to reject it.