sandbox method

IdbFactory sandbox({
  1. required String path,
})

Factory sandboxing.

Every database opened or deleted through the returned factory is located below path in the original factory.

If the factory is already a sandbox, the tree is sanitized (i.e. never 2 levels of sandboxing).

Works with any IdbFactory implementation (native, io, memory).

Implementation

IdbFactory sandbox({required String path}) {
  var self = this;
  if (self is _IdbFactorySandbox) {
    return _IdbFactorySandbox(
      delegate: self.delegate,
      rootPath: self.delegatePath(path),
    );
  }
  return _IdbFactorySandbox(delegate: this, rootPath: path);
}