size property

Size? get size

The size of the RenderBox returned by findRenderObject.

This getter will only return a valid result after the layout phase is complete. It is therefore not valid to call this from a build method. It should only be called from paint callbacks or interaction event handlers (e.g. gesture callbacks).

For details on the different phases of a frame, see the discussion at WidgetsBinding.drawFrame.

This getter will only return a valid result if findRenderObject actually returns a RenderBox. If findRenderObject returns a render object that is not a subtype of RenderBox (e.g., RenderView), this getter will throw an exception in debug mode and will return null in release mode.

Calling this getter is theoretically relatively expensive (O(N) in the depth of the tree), but in practice is usually cheap because the tree usually has many render objects and therefore the distance to the nearest render object is usually short.

Implementation

Size? get size;