getOrInit method

  1. @override
T getOrInit(
  1. T func()
)
override

Gets the contents of the cell, initializing it with func if the cell was empty.

Implementation

@override
T getOrInit(T Function() func) {
  var val = _cache[this] as (T,)?;
  if (val != null) {
    return val.$1;
  }
  val = (func(),);
  _cache[this] = val;
  return val.$1;
}