setValueAtPath method

bool setValueAtPath(
  1. List<Object> parts,
  2. Object? value
)

Set a value at a given path, parts must not be empty true if set

Implementation

bool setValueAtPath(List<Object> parts, Object? value) {
  var first = parts.first;
  if (first is String) {
    var field = this.field(first);
    if (field != null) {
      if (parts.length == 1) {
        field.v = value;
        return true;
      } else {
        var childValue = field.valueOrNull;
        if (childValue != null) {
          return anyRawSetValueAtPath(childValue, parts.sublist(1), value);
        }
      }
    }
  }
  return false;
}