setProperties static method

void setProperties(
  1. dynamic obj,
  2. Map<String, dynamic>? values
)

Recursively sets values of some (all) object and its subobjects properties.

The object can be a user defined object, map or array. Property values correspondently are object properties, map key-pairs or array elements with their indexes.

If some properties do not exist or introspection fails they are just silently skipped and no errors thrown.

  • obj an object to write properties to.
  • values a map, containing property names and their values.

See setProperty

Implementation

static void setProperties(obj, Map<String, dynamic>? values) {
  if (values == null) return;

  for (var key in values.keys) {
    var value = values[key];
    RecursiveObjectWriter.setProperty(obj, key, value);
  }
}