disable<T> static method

T disable<T>(
  1. T callback(), {
  2. bool when = true,
})

If when is true and this is called within a Chain.capture zone, runs callback in a Zone in which chain capturing is disabled.

If callback returns a value, it will be returned by disable as well.

Implementation

static T disable<T>(T Function() callback, {bool when = true}) {
  var zoneValues =
      when ? {_specKey: null, StackZoneSpecification.disableKey: true} : null;

  return runZoned(callback, zoneValues: zoneValues);
}