putValue method
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
andvalue
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;
}