debugThrowIfNotCheckingIntrinsics method

  1. @protected
bool debugThrowIfNotCheckingIntrinsics()

Throws an exception saying that the object does not support returning intrinsic dimensions if, in debug mode, we are not in the RenderObject.debugCheckingIntrinsics mode.

This is used by computeMinIntrinsicWidth et al because viewports do not generally support returning intrinsic dimensions. See the discussion at computeMinIntrinsicWidth.


bool debugThrowIfNotCheckingIntrinsics() {
  assert(() {
    if (!RenderObject.debugCheckingIntrinsics) {
      throw FlutterError.fromParts(<DiagnosticsNode>[
        ErrorSummary('$runtimeType does not support returning intrinsic dimensions.'),
          'Calculating the intrinsic dimensions would require instantiating every child of '
          'the viewport, which defeats the point of viewports being lazy.',
    return true;
  return true;