takeOrNull method

  1. @override
T? takeOrNull()
override

Takes the value out of this OnceCell, moving it back to an uninitialized state. Returns null if the cell is empty.

Implementation

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