operator []= method

void operator []=(
  1. String name,
  2. Object value
)

Dynamic, type-checked assignment. Dispatches on the parameter's declared type and throws if value's runtime type does not match.

Implementation

void operator []=(String name, Object value) {
  final slot = _layout[name];
  if (slot != null) {
    _setDynamic(name, slot.type, value);
    return;
  }
  if (_samplers.containsKey(name)) {
    if (value is gpu.Texture) {
      setTexture(name, value);
      return;
    }
    throw ArgumentError('Sampler parameter "$name" requires a gpu.Texture.');
  }
  throw ArgumentError('Unknown material parameter "$name".');
}