preload method
Compiles and caches all shader programs.
Safe to call multiple times — subsequent calls are no-ops.
If compilation fails (e.g. on the HTML web renderer which does not support ui.FragmentProgram), the error is caught and logged. All transitions will then fall back to a FadeTransition.
Implementation
Future<void> preload() async {
if (_loaded) return;
try {
await Future.wait(
_shaderKeys.map((key) => _loadProgram(key)),
);
_loaded = true;
} catch (e) {
debugPrint('shader_transitions: Failed to load shaders — '
'transitions will fall back to FadeTransition. Error: $e');
}
}