constraints property Null safety

  1. @protected
Constraints constraints

The layout constraints most recently supplied by the parent.

If layout has not yet happened, accessing this getter will throw a StateError exception.


Constraints get constraints {
  if (_constraints == null) {
    throw StateError('A RenderObject does not have any constraints before it has been laid out.');
  return _constraints!;