static SimpleLiveValue varWithNotifyToLiveValue(Class type, IVarWithNotify var) {
if (var == null) null;
var lv = new SimpleLiveValue(type);
var lvRef = weakRef(lv);
var.onChange(r {
var lv = lvRef!;
print ifdef varWithNotifyToLiveValue_debug("varWithNotifyToLiveValue var.onChange " + lv);
if (lv == null)
var.removeChangeListener(this);
else {
var value = var!;
print ifdef varWithNotifyToLiveValue_debug("varWithNotifyToLiveValue value " + value);
lv.set(value);
}
});
lv.onChange(-> var.set(lv!));
lv.set(var!);
ret lv;
}