debugAssertAllFoundationVarsUnset function

bool debugAssertAllFoundationVarsUnset(
  1. String reason, {
  2. DebugPrintCallback debugPrintOverride = debugPrintThrottled,
})

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

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

The debugPrintOverride argument can be specified to indicate the expected value of the debugPrint variable. This is useful for test frameworks that override debugPrint themselves and want to check that their own custom value wasn't overridden by a test.

See the foundation library for a complete list.

Implementation

bool debugAssertAllFoundationVarsUnset(String reason, { DebugPrintCallback debugPrintOverride = debugPrintThrottled }) {
  assert(() {
    if (debugPrint != debugPrintOverride ||
        debugDefaultTargetPlatformOverride != null ||
        debugDoublePrecision != null ||
        debugBrightnessOverride != null) {
      throw FlutterError(reason);
    }
    return true;
  }());
  return true;
}