useIsMounted function Null safety

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

IsMounted useIsMounted() {
  return use(const _IsMountedHook());
}