PersistentValueBlop<T> constructor

PersistentValueBlop<T>(
  1. FutureOr<T> _defaultValue(), {
  2. PersistentBlopStore<T>? store,
  3. String? valueName,
  4. bool reloadOnCreate = true,
})

Implementation

PersistentValueBlop(
  this._defaultValue, {
  PersistentBlopStore<T>? store,
  String? valueName,
  bool reloadOnCreate = true,
})  : _store = store ?? HiveBlopStore<T>(),
      super(
        _lrc = Cubits.fromValue<FutureOr<T> Function()>(
          () => null as dynamic,
        ),
        reloadOnCreate: false,
        reloadOnLoaderChange: false,
      ) {
  _valueName = valueName ?? runtimeType.toString();
  // HACK all this shitty code only for pass store.load to super constructor, hate this shit
  _reloadCubit = _lrc;
  _lrc = null;
  _reloadCubit.emit(_store.load);

  if (reloadOnCreate) reload();
}