setValue method

void setValue(
  1. AFThemeID id,
  2. dynamic value, {
  3. AFCreateDynamicDelegate? defaultCalculation,
  4. bool notNull = true,
})

Set a fundamental value.

If the value exists, it is not overwritten. Because the app populates the builder first, this allows the app to override values for plugins.

Implementation

void setValue(AFThemeID id, dynamic value, {
  AFCreateDynamicDelegate? defaultCalculation,
  bool notNull = true
}) {
  if(!values.containsKey(id)) {
    if(value == null && defaultCalculation != null) {
      value = defaultCalculation();
    }
    if(notNull && value == null) {
      throw AFException("Value for $id cannot be null");
    }
    values[id] = AFFundamentalThemeValue(id: id, value: value);
  }
}