Replace your setState() calls with setStateIfMounted() and define it as: void setStateIfMounted(f) { if (mounted) setState(f); }