initialize method

Future<void> initialize(
  1. String name, {
  2. String? subDir,
  3. bool lazy = false,
})

Implementation

Future<void> initialize(String name,
    {String? subDir, bool lazy = false}) async {
  if (!isInitialize) {
    _name = name;
    _lazy = lazy;
    await Hive.initFlutter(subDir ?? 'hive');
    isInitialize = true;
    if (lazy) {
      await openLazyBox();
    } else {
      await openBox();
    }
  }
}