engineAsync top-level constant

Rule const engineAsync

Awaiting the engine's image pipeline outside runAsync.

Implementation

const engineAsync = Rule(
  id: 'engine-async',
  severity: Severity.error,
  title:
      'Awaits engine image work (toImage, toByteData, decoding) outside '
      'runAsync',
  why:
      'Image.toByteData, Picture.toImage, RenderRepaintBoundary.toImage, '
      'Codec.getNextFrame, decodeImageFromList and precacheImage wait for '
      'the engine. The result arrives on the real event loop, outside '
      'FakeAsync, so the test stops at its next await, or never finishes '
      'after the body returns.',
  fix:
      'Wrap the call in `await tester.runAsync(() => ...)`. For goldens, '
      'prefer matchesGoldenFile, which handles this for you.',
);