putValue method

RudderProperty putValue({
  1. String? key,
  2. dynamic value,
  3. Map<String, dynamic>? map,
})

Sets properties using either a key-value pair or a map of properties.

This method provides flexible ways to set properties:

  • If map is provided, all key-value pairs from the map are added
  • If key and value are provided, sets a single property
  • If value is a RudderProperty, its internal map is used

key - The property key (optional if map is provided). value - The property value (optional if map is provided). map - A map of properties to add (optional if key/value are provided). Returns this RudderProperty instance for method chaining.

Implementation

RudderProperty putValue(
    {String? key, dynamic value, Map<String, dynamic>? map}) {
  if (map != null) {
    __map.addAll(map);
    return this;
  }
  if (key != null) {
    if (value is RudderProperty) {
      __map[key] = value.getMap();
    } else {
      __map[key] = value;
    }
  }
  return this;
}