set method
- @Deprecated('Use publish() with explicit payload instead')
- dynamic data, [
- TTMsgCb? cb
Add a unique item to an unordered list.
Works like a mathematical set, where each item in the list is unique. If the item is added twice, it will be merged. This means only objects, for now, are supported.
@param data should be a TT reference or an object @param cb The callback is invoked exactly the same as .put @returns link context for added object
Implementation
@Deprecated('Use publish() with explicit payload instead')
TTLink set(dynamic data, [TTMsgCb? cb]) {
if (data is TTLink && !isNull(data.soul)) {
final temp = {};
temp[data.soul] = {'#': data.soul};
put(temp, cb);
} else if (data is TTNode) {
final temp = {};
temp[data.nodeMetaData?.key] = data;
put(temp, cb);
} else {
throw ('set() is only partially supported');
}
return this;
}