putIfAbsent method

V putIfAbsent(
  1. K key,
  2. V create()
)

Implementation

V putIfAbsent(K key, V Function() create) {
  final V? value = this[key];
  if (null == value) {
    final V newValue = create();
    this[key] = newValue;
    return newValue;
  } else {
    return value;
  }
}