useFirstMountState function

bool useFirstMountState()

Returns true if component is just mounted (on first build) and false otherwise.

Implementation

bool useFirstMountState() {
  final isFirst = useRef(true);

  if (isFirst.value) {
    isFirst.value = false;

    return true;
  }

  return isFirst.value;
}