initFlutter method

Future<void> initFlutter([
  1. String? subDir
])

Initializes Hive with the path from getApplicationDocumentsDirectory.

You can provide a subDir where the boxes should be stored.

Implementation

Future<void> initFlutter([String? subDir]) async {
  WidgetsFlutterBinding.ensureInitialized();
  if (kIsWeb) return;

  var appDir = await getApplicationDocumentsDirectory();
  init(path_helper.join(appDir.path, subDir));
}