onDetachedMountCheck property

  1. @override
BoolCallback? get onDetachedMountCheck
override

A callback that returns a bool that indicates whether the ResizeSensor was detached from the DOM when it first mounted.

Why would I need to set this callback?

If you have a ResizeSensor that is not emitting its onResize events, then the sensor was most likely mounted detached from the DOM. In that situation, the use of this callback is the recommended way to repair the resize behavior via a call to ResizeSensorComponent.forceResetDetachedSensor at a time when you are sure that the sensor has become attached to the DOM.

What does the bool argument indicate?

  • A true argument indicates that the ResizeSensor was mounted detached from the DOM, and a call to ResizeSensorComponent.forceResetDetachedSensor will be necessary to re-initialize the sensor.

    NOTE: The re-initialization comes at the expense of force-clamping the scrollLeft / scrollTop values of the expand / collapse sensor nodes to the maximum possible value - which is what forces the reflow / paint that makes the onResize callbacks begin firing when expected again.

  • A false argument indicates that the ResizeSensor was mounted attached to the DOM.

    NOTE: If this happens - you most likely do not need to set this callback. If for some reason the callback sometimes returns true, and sometimes returns false (unexpected), you may have other underlying issues in your implementation that should be addressed separately.

Implementation

@override
BoolCallback? get onDetachedMountCheck =>
    (props[_$key__onDetachedMountCheck__ResizeSensorProps] ?? null)
        as BoolCallback?;
  1. @override
set onDetachedMountCheck (BoolCallback? value)
override

A callback that returns a bool that indicates whether the ResizeSensor was detached from the DOM when it first mounted.

Why would I need to set this callback?

If you have a ResizeSensor that is not emitting its onResize events, then the sensor was most likely mounted detached from the DOM. In that situation, the use of this callback is the recommended way to repair the resize behavior via a call to ResizeSensorComponent.forceResetDetachedSensor at a time when you are sure that the sensor has become attached to the DOM.

What does the bool argument indicate?

  • A true argument indicates that the ResizeSensor was mounted detached from the DOM, and a call to ResizeSensorComponent.forceResetDetachedSensor will be necessary to re-initialize the sensor.

    NOTE: The re-initialization comes at the expense of force-clamping the scrollLeft / scrollTop values of the expand / collapse sensor nodes to the maximum possible value - which is what forces the reflow / paint that makes the onResize callbacks begin firing when expected again.

  • A false argument indicates that the ResizeSensor was mounted attached to the DOM.

    NOTE: If this happens - you most likely do not need to set this callback. If for some reason the callback sometimes returns true, and sometimes returns false (unexpected), you may have other underlying issues in your implementation that should be addressed separately.

Implementation

@override
set onDetachedMountCheck(BoolCallback? value) =>
    props[_$key__onDetachedMountCheck__ResizeSensorProps] = value;