useIsMounted function
- @Deprecated("Use BuildContext.mounted instead if you're on Flutter 3.7.0 or greater")
Returns an IsMounted object that you can use to check if the State is mounted.
final isMounted = useIsMounted();
useEffect((){
myFuture.then((){
if (isMounted()) {
// Do something
}
});
}, []);
See also:
- The State.mounted property.
Implementation
@Deprecated(
"Use BuildContext.mounted instead if you're on Flutter 3.7.0 or greater",
)
IsMounted useIsMounted() {
return use(const _IsMountedHook());
}