Skip to content

A Flutter package to check if mounted before calling setState

License

Notifications You must be signed in to change notification settings

vixez/mounted_state

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Features

A safe way to call setState without having to worry about mounted.

Don't use this to get around the Flutter framework. Only use this if for example you are doing async stuff and can't use FutureBuilder or something similar.

Usage

Add MountedState or MountedStateOverride like any other mixin.

class _MyHomePageState extends State<MyHomePage> with MountedState, MountedStateOverride

MountedState adds setMountedState which you can use instead of setState.

MountedStateOverride will override setState.

Both always check if the widget is mounted before calling setState.

About

A Flutter package to check if mounted before calling setState

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published