debugAssertAllPaintingVarsUnset function Null safety

bool debugAssertAllPaintingVarsUnset(
  1. String reason,
  2. {bool debugDisableShadowsOverride = false}
)

Returns true if none of the painting library debug variables have been changed.

This function is used by the test framework to ensure that debug variables haven't been inadvertently changed.

See the painting library for a complete list.

The debugDisableShadowsOverride argument can be provided to override the expected value for debugDisableShadows. (This exists because the test framework itself overrides this value in some cases.)

Implementation

bool debugAssertAllPaintingVarsUnset(String reason, { bool debugDisableShadowsOverride = false }) {
  assert(() {
    if (debugDisableShadows != debugDisableShadowsOverride ||
        debugNetworkImageHttpClientProvider != null ||
        debugOnPaintImage != null ||
        debugInvertOversizedImages == true ||
        debugImageOverheadAllowance != _imageOverheadAllowanceDefault) {
      throw FlutterError(reason);
    }
    return true;
  }());
  return true;
}