Use of the Future in the StateNotifier
kmartins opened this issue · 2 comments
kmartins commented
When I use the future in StateNotifier
and the state
is changed with the response this future
, but the response arrives after the dispose
of the Statenotifier
.
Do I have to verify mounted
before changed the state
always?
Because I'm getting:
Tried to use $runtimeType after `dispose` was called. Consider checking `mounted`.
rrousselGit commented
You should preferably override dispose
to cancel pending futures.
kmartins commented
Right, but why do not replace assert (_debugIsMounted (), ‘’);
for the if (mounted)
in the set state?