isInBox property Null safety

bool isInBox

Returns whether this object is currently stored in a box.

For lazy boxes this only checks if the key exists in the box and NOT whether this instance is actually stored in the box.

Implementation

bool get isInBox {
  if (_box != null) {
    if (_box!.lazy) {
      return _box!.containsKey(_key);
    } else {
      return true;
    }
  }
  return false;
}