close method

Future<bool> close({
  1. bool deleteFromDisk = false,
})

Releases an Isar instance.

If this is the only isolate that holds a reference to this instance, the Isar instance will be closed. deleteFromDisk additionally removes all database files if enabled.

Returns whether the instance was actually closed.

Implementation

Future<bool> close({bool deleteFromDisk = false}) {
  requireOpen();
  _isOpen = false;
  if (identical(_instances[name], this)) {
    _instances.remove(name);
  }
  for (final callback in _closeCallbacks) {
    callback(name);
  }
  return Future.value(false);
}