useUpdateEffect function

void useUpdateEffect(
  1. Dispose? effect(), [
  2. List<Object?>? keys
])

Flutter effect hook that ignores the first invocation (e.g. on mount). The signature is exactly the same as the useEffect hook.

Implementation

void useUpdateEffect(Dispose? Function() effect, [List<Object?>? keys]) {
  final isFirstMount = useFirstMountState();

  // ignore: body_might_complete_normally_nullable
  useEffect(
    () {
      if (!isFirstMount) {
        return effect();
      }
      return null;
    },
    keys,
  );
}