bindObserver function

void bindObserver({
  1. ScreenStatusCallback? onResume,
  2. ScreenStatusCallback? onPause,
  3. ScreenStatusCallback? onInactive,
  4. ScreenStatusCallback? onDetach,
  5. ScreenStatusCallback? onSuspend,
})

Implementation

void bindObserver({
  ScreenStatusCallback? onResume,
  ScreenStatusCallback? onPause,
  ScreenStatusCallback? onInactive,
  ScreenStatusCallback? onDetach,
  ScreenStatusCallback? onSuspend
}){
  WidgetsBinding.instance.addObserver(NUILifecycleEventHandler(
    resumeCallBack: onResume ?? (){},
    pauseCallback: onPause ?? (){},
    inactiveCallback: onInactive ?? (){},
    detachCallback: onDetach ?? (){},
    suspendCallback: onSuspend ?? (){},
  ));
}