useIsMounted function

  1. @Deprecated("Use BuildContext.mounted instead if you're on Flutter 3.7.0 or greater")
IsMounted useIsMounted()

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:

Implementation

@Deprecated(
  "Use BuildContext.mounted instead if you're on Flutter 3.7.0 or greater",
)
IsMounted useIsMounted() {
  return use(const _IsMountedHook());
}