Search code snippets, questions, articles...

Avoid setState after dispose solution

Override setState function to avoid calling setState after dispose
@override
void setState(VoidCallback fn) {
    if(mounted) {
        super.setState(fn);
    }
}

Search Index Data (The code snippet can also be found with below search text)

setState
dispose
Was this helpful?
0 Comments
Programming Feeds
Learn something new everyday on Devsheet