addProp method

void addProp(
  1. dynamic propKey,
  2. dynamic value, [
  3. bool shouldAdd = true
])

Adds an arbitrary propKey/value pair if shouldAdd is true.

Is a noop if shouldAdd is false.

Related: addProps

Implementation

void addProp(propKey, value, [bool shouldAdd = true]) {
  if (!shouldAdd) return;

  this[propKey] = value;
}