disable<T> method

T disable <T>(T callback(), { 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 callback(), {bool when: true}) {
  var zoneValues =
      when ? {_specKey: null, StackZoneSpecification.disableKey: true} : null;

  return runZoned(callback, zoneValues: zoneValues);
}