Open rubenvereecken opened 4 years ago
Having seen this happen quite a few times now, I can confirm it happens when the enclosing build
gets called again quickly after the first call. Why this happens I still cannot fathom. It seems pretty random -- Widget.build
gets called somewhere between 1 (happy days) and 3 times.
I have worked around it by being clever with the key
parameter, only changing it when I do want a new SplashScreent to be constructed, which isn't before onError
is called in my case.
Ok strange one ^^ never got it because I don't play with key or rebuild for my splashscreen ^^ I'll try to take a look when I have time, but if someone can make a PR to fix that it would be welcome :D
I'll keep an eye on it and see if I can fix it.
Thing is, I got the error even without rebuilding. Because somehow, something decides to call build
on my Widget twice in quick succession. Sometimes. I looked up why and Flutter docs simply state that build
should be a pure function without side-effects because if the parent gets resized or something, build might get called again. This widget does live inside a Scaffold I just realised so maybe it's got something to do with that resizing.. No idea yet.
So the error is not in this repo but in flare_loading, which is a statefulWidget, so I think before each setState a check should be made to see if widget is still mounted
, you can try that manually as you manage to sometime reproduce it on your side see if it fix the problem
Hi, it's me again, your favourite source of unwanted bug reports.
I'll start off with the error message.
Now this has proven a really pesky one to debug because it doesn't always occur. So it's a time-sensitive issue, a race condition. I included a bit of stacktrace above that points to
flare_loading
and indeed, it does setsetState
. I have a feeling myuntil
function finishes before my animation finishes. MyonSuccess
navigates elsewhere so I assume this removes the widget from the tree or something, which meshes with the verbose error I get. Still, I haven't been able to figure it out exactly.I thought I'd report it here in case any of things rings a bell or the solution is obvious.