getOrInit method

T getOrInit(
  1. T func()
)

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

Implementation

T getOrInit(T Function() func) {
  if (_isSet) {
    return _val!;
  }
  _val = func();
  _isSet = true;
  return _val!;
}