compile method Null safety

Future<FragmentProgram> compile(
  1. {required ByteBuffer spirv,
  2. bool debugPrint = false}
)

Creates a fragment program from SPIR-V byte data as an input.

One instance should be created per SPIR-V input. The constructed object should then be reused via the shader method to create Shader objects that can be used by Shader.paint.

A current specification of valid SPIR-V is here. SPIR-V not meeting this specification will throw an exception.

Implementation

static Future<FragmentProgram> compile({
  required ByteBuffer spirv,
  bool debugPrint = false,
}) {
  // Delay compilation without creating a timer, which interacts poorly with the
  // flutter test framework. See: https://github.com/flutter/flutter/issues/104084
  return Future<FragmentProgram>.microtask(() => FragmentProgram._(spirv: spirv, debugPrint: debugPrint));
}