initFlutter method

Future initFlutter([
  1. String? subDir
])

Initializes Hive with the path from getApplicationDocumentsDirectory.

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

Implementation

Future initFlutter([String? subDir]) async {
  WidgetsFlutterBinding.ensureInitialized();
  if (!kIsWeb) {
    var appDir = await getApplicationDocumentsDirectory();
    if (appDir != null) {
      init(path_helper.join(appDir.path, subDir));
    } else {
      NullThrownError();
    }
  }
}