takeOrOption method

  1. @override
Option<T> takeOrOption()
override

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

Implementation

@override
Option<T> takeOrOption() {
  if (_val == null) {
    return None;
  }
  final val = _val;
  _val = null;
  return Some(val!);
}