initPersistence static method

  1. @Deprecated('Use configPersistence method')
Future<void> initPersistence(
  1. String? storeLocation
)

Creates a directory on the disk to save stringified objects. storeLocation is optional for Web. Persistence also enables cache behind the scenes.

Implementation

@Deprecated('Use configPersistence method')
static Future<void> initPersistence(String? storeLocation) async {
  if (_persistent && _storeName != null) {
    if (storeLocation != null) {
      Hive.init(storeLocation);
    }
    await Hive.openBox(_storeName!);

    // Config cache when persistence is in use
    await MustangCache.initCache(_cacheStoreName!, storeLocation);
  }
}