Skip to content

Latest commit

 

History

History
30 lines (25 loc) · 847 Bytes

useLifecycles.md

File metadata and controls

30 lines (25 loc) · 847 Bytes

useLifecycles

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 or useOnAppLifecycleStateChange

Installation

dependencies:
  flutter_use: ^0.0.2

Usage

class Sample extends HookWidget {
  @override
  Widget build(BuildContext context) {
    useLifecycles(
      mount: () {
        debugPrint('mounted');
      },
      unmount: () {
        debugPrint('unmounted');
      },
    );
    return Container();
  }
}