initialize method

Future<void> initialize({
  1. bool enableDotenv = true,
  2. bool enableHive = true,
})

Implementation

Future<void> initialize({
  bool enableDotenv = true,
  bool enableHive = true,
}) async {
  if (enableDotenv) {
    await dotenv.load();
  }
  if (enableHive) {
    await Hive.initFlutter();
    await Hive.openBox('truesight_app_service');
  }

  Directory documentsDir = await getApplicationDocumentsDirectory();
  final documentsPath = documentsDir.path;
  persistCookieJar = PersistCookieJar(
    ignoreExpires: true,
    storage: FileStorage(documentsPath),
    persistSession: true,
  );

  DioImage.defaultDio.interceptors.add(
    CookieManager(truesightService.persistCookieJar),
  );
}