operator [] method

Shader? operator [](
  1. String shaderName
)

Implementation

Shader? operator [](String shaderName) {
  // This `flutter_gpu` library isn't always registered as part of the
  // builtin DartClassLibrary, and so we can't instantiate the Dart classes
  // on the engine side. Providing a new wrapper to [_getShader] for
  // wrapping the native counterpart (if it hasn't been wrapped already)
  // is a hack to work around this.
  return shaders_.putIfAbsent(
    shaderName,
    () => _getShader(shaderName, Shader._()),
  );
}