useLifecycles function

void useLifecycles({
  1. VoidCallback? mount,
  2. VoidCallback? unmount,
})

Flutter lifecycle hook that call mount and unmount callbacks, when component is mounted and un-mounted, respectively. If you want to use hook that app lifecycles, recommended use to flutter_hooks v0.18.1+ useAppLifecycleState(ref link1) or useOnAppLifecycleStateChange(ref link2) ref link1 ref link2

Implementation

void useLifecycles({VoidCallback? mount, VoidCallback? unmount}) {
  useEffect(() {
    mount?.call();
    return () => unmount?.call();
  }, const []);
}