readSelf<T> method
T?
readSelf<T>()
Read the current state of the ref owner. This allows creators to have memories. Note that the creator needs defined in a stable variable or use args if using this method. See CreatorBase.args.
Implementation
T? readSelf<T>() {
assert(_owner != null, 'readSelf is called outside of create method');
if (!_elements.containsKey(_owner)) {
return null;
}
return _owner is Creator<T>
? _element(_owner! as Creator<T>).state
: (_element(_owner! as Emitter<T>) as EmitterElement<T>).value;
}