RealRxStorage<Key extends Object, Options, S extends Storage<Key, Options>> constructor

RealRxStorage<Key extends Object, Options, S extends Storage<Key, Options>>(
  1. FutureOr<S> storageOrFuture, [
  2. RxStorageLogger<Key, Options>? logger,
  3. void _onDispose()?
])

Construct a RealRxStorage.

Implementation

RealRxStorage(
  FutureOr<S> storageOrFuture, [
  final RxStorageLogger<Key, Options>? logger,
  this._onDispose,
]) {
  if (storageOrFuture is Future<S>) {
    _storageFuture = storageOrFuture.then((value) {
      assert(_storage is! RxStorage<Key, Options>);
      return _storage = value;
    });
  } else {
    _storage = storageOrFuture;
    assert(_storage is! RxStorage<Key, Options>);
  }

  _keyValuesSubject.disposedBy(_bag);
  logger?.let(_setupLogger);
}