setObservable method
void
setObservable(
- String? key,
- dynamic value
)
Implementation
void setObservable(String? key, dynamic value)
{
Binding? binding = Binding.fromString(key);
if(binding == null) return;
// Find Observable
Observable? observable = getObservable(binding);
// Set Value
if (value is String && Observable.isEvalSignature(value))
{
value = Observable.getEvalSignature(value);
value = Observable.doEvaluation(value);
}
// Create the Observable
if (observable == null)
{
Scope? scope = this;
if (binding.scope != null) scope = System.app?.scopeManager.of(binding.scope);
if (scope != null)
{
var observable = StringObservable(binding.key, value, scope: this);
scope.register(observable);
}
}
// Set the Value
else observable.set(value);
}