mounted_state 1.0.1 copy "mounted_state: ^1.0.1" to clipboard
mounted_state: ^1.0.1 copied to clipboard

Easily check if a widget is mounted before calling setState.

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.

0
likes
140
pub points
68%
popularity

Publisher

verified publisherglennruysschaert.com

Easily check if a widget is mounted before calling setState.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on mounted_state