initialize static method
Initializes the CookieStorageService by setting up a persistent cookie jar.
Returns:
- A Future that resolves to an instance of CookieStorageService.
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,
);
}