close method

void close()

Closes this store.

Don't try to call any other ObjectBox methods after the store is closed.

Implementation

void close() {
  if (_closed) return;
  _closed = true;

  _boxes.values.forEach(InternalBoxAccess.close);
  _boxes.clear();

  // Call each "onClose()" event listener.
  // Move the list to prevent "Concurrent modification during iteration".
  _onClose.values.toList(growable: false).forEach((listener) => listener());
  _onClose.clear();

  if (!_weak) checkObx(C.store_close(_cStore));
}