isInBox property

bool get 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 {
  final box = _box;
  if (box != null) {
    if (box.lazy) {
      return box.containsKey(_key);
    } else {
      return true;
    }
  }
  return false;
}