blockingSleep top-level constant

Rule const blockingSleep

Blocking the isolate with sleep().

Implementation

const blockingSleep = Rule(
  id: 'blocking-sleep',
  severity: Severity.warning,
  title: 'Calls sleep() inside a widget test',
  why:
      'sleep() blocks the isolate for real time and does not move the fake '
      'clock, so timers, animations and debounces still have not fired '
      'afterwards. Real async work cannot make progress while the isolate '
      'sleeps either.',
  fix:
      'Use `await tester.pump(duration)` to let fake time pass, or '
      '`await tester.runAsync(() => Future<void>.delayed(duration))` to wait '
      'for real work.',
);