fromAsset method Null safety
- String assetKey
Creates a fragment program from the asset with key assetKey
.
The asset must be a file produced as the output of the impellerc
compiler. The constructed object should then be reused via the shader
method to create Shader objects that can be used by Shader.paint
.
Implementation
static Future<FragmentProgram> fromAsset(String assetKey) {
final FragmentProgram? program = _shaderRegistry[assetKey]?.target;
if (program != null) {
return Future<FragmentProgram>.value(program);
}
return Future<FragmentProgram>.microtask(() {
final FragmentProgram program = FragmentProgram._fromAsset(assetKey);
_shaderRegistry[assetKey] = WeakReference<FragmentProgram>(program);
return program;
});
}