initialize static method

Initializes the CookieStorageService by setting up a persistent cookie jar.

Returns:

Implementation

static Future<CookieStorageService> initialize() async {
  if (kIsWeb) {
    final cookieJar = WebCookieJar();
    return _CookieStorageServiceImpl._(
      persistCookieJar: cookieJar,
    );
  }

  final documentsDir = await getApplicationCacheDirectory();

  PersistCookieJar persistCookieJar = PersistCookieJar(
    storage: FileStorage(documentsDir.path),
  );

  return _CookieStorageServiceImpl._(
    persistCookieJar: persistCookieJar,
  );
}