useOnce function

void useOnce(
  1. void Function()? effect()
)

Implementation

void useOnce(void Function()? Function() effect) {
  useEffect(
    () {
      final call = effect();
      return () => {
            if (call != null) call(),
          };
    },
    [],
  );
}