mount<T> method
Returns value by given key
and Type from this Widget's internal arg store.
If object is not found, then widget will init
and store it to args.
Object is also registered for dispose.
Internally uses ControlArgs. Check ControlArgs.getWithFactory.
Use holder.argStore
to get raw access to ControlArgs.
Implementation
T? mount<T>({dynamic key, T Function()? init, bool stateNotifier = false}) {
final value =
holder.argStore.getWithFactory<T>(key: key, defaultValue: init);
if (value is Disposable) {
if (stateNotifier) {
registerStateNotifier(value);
} else {
register(value);
}
}
return value;
}