precacheSceneShaders function

Future<void> precacheSceneShaders(
  1. SceneDocument scene
)

Loads every fragment program scene paints with.

A flutterware lane waits for these loads by itself. A plain flutter test does not — pumpAndSettle never asks — so a test that pumps a scene with a shader pass loads them first, or the pass is blank. In a testWidgets that is on the real clock, because a program's load never completes under the fake one and awaiting it directly hangs the test:

await tester.runAsync(() => precacheSceneShaders(scene));

A plain test() runs on the real clock already, and awaits it directly.

Implementation

Future<void> precacheSceneShaders(SceneDocument scene) => Future.wait([
  for (var asset in sceneShaderAssets(scene))
    SceneShaderPrograms.instance.load(asset),
]);