sandbox method

SdbFactory 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 SdbFactory implementation (io, memory, web).

Implementation

SdbFactory sandbox({required String path}) {
  var self = this;
  if (self is _SdbFactorySandbox) {
    return _SdbFactorySandbox(
      delegate: self.delegate,
      rootPath: self.delegatePath(path),
    );
  }
  return _SdbFactorySandbox(
    delegate: (this as SdbFactoryIdb),
    rootPath: path,
  );
}