preWarm static method

Future<void> preWarm()

Pre-warms the shaders for this effect.

A call made while the program is loading returns that load, so every caller resumes once the program is ready (or has failed to load).

Implementation

static Future<void> preWarm() {
  if (_cachedProgram != null) return Future<void>.value();
  if (_preparing case final pending?) return pending;
  final load = _load();
  _preparing = load;
  // _load reports its own errors, so this chain never throws.
  load.whenComplete(() {
    if (identical(_preparing, load)) _preparing = null;
  });
  return load;
}