initState method
void
initState()
Implementation
void initState() {
widget.initState?.call(this);
var isRegistered = June.isRegistered<T>(tag: widget.tag);
if (widget.global) {
if (isRegistered) {
if (June.isPrepared<T>(tag: widget.tag)) {
_isCreator = true;
} else {
_isCreator = false;
}
_controllerBuilder = () => June.find<T>(tag: widget.tag);
} else {
_controllerBuilder =
() => (widget.create?.call(this) ?? widget.init?.call());
_isCreator = true;
if (widget.lazy) {
June.lazyPut<T>(_controllerBuilder!, tag: widget.tag);
} else {
June.put<T>(() => _controllerBuilder!(), tag: widget.tag);
}
}
} else {
if (widget.create != null) {
_controllerBuilder = () => widget.create!.call(this);
June.spawn<T>(_controllerBuilder!, tag: widget.tag, permanent: false);
} else {
_controllerBuilder = widget.init;
}
_controllerBuilder =
(widget.create != null ? () => widget.create!.call(this) : null) ??
widget.init;
_isCreator = true;
_needStart = true;
}
}