getWithFactory<T> method
T?
getWithFactory<T>({
- dynamic key,
- T defaultValue()?,
Returns object of given key
or initialize defaultValue
and stores that value to args store.
Implementation
T? getWithFactory<T>({dynamic key, T Function()? defaultValue}) {
final item = Parse.getArgFromMap<T>(_args, key: key);
if (item == null && defaultValue != null) {
final defaultItem = defaultValue.call();
add<T>(key: key, value: defaultItem);
return defaultItem;
}
return item;
}