realIo top-level constant

Rule const realIo

Awaiting dart:io work outside runAsync.

Implementation

const realIo = Rule(
  id: 'real-io',
  severity: Severity.error,
  title: 'Awaits real file, process or socket I/O outside runAsync',
  why:
      'dart:io completes on the real event loop, but the continuation is '
      'queued in the FakeAsync zone, which only drains when the test pumps. '
      'The test waits for I/O that has finished but is never delivered.',
  fix:
      'Wrap the call in `await tester.runAsync(() => ...)`, or do the I/O in '
      'setUp/setUpAll, or use an in-memory fake (for example package:file).',
);