webview_cookie_manager
쿠키 관리 문제로 전락하셨나요? 이 패키지가 도움이 될 수 있습니다. 여러분이 찾고 있던 모든 쿠키 관리 기능이 포함되어 있습니다.
fryette/webview_cookie_manager open-source repository details.
{"sdk":"flutter"}{"sdk":"flutter"}아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
A flutter library to manager your web cookies for Android (API level 9+) and iOS (11+).
The cookies stores and retrieves using the httpCookieStore for iOS and CookieManager for Android.
Set minimum version for iOS to 11.0
The WebCookieManager can be used directly or together with webview_flutter.
final cookieManager = WebviewCookieManager();
final gotCookies = await cookieManager.getCookies('https://youtube.com');
for (var item in gotCookies) {
print(item);
}
await cookieManager.setCookies([
Cookie('cookieName', 'cookieValue')
..domain = 'youtube.com'
..expires = DateTime.now().add(Duration(days: 10))
..httpOnly = false
]);
await cookieManager.hasCookies();
await cookieManager.removeCookie();
await cookieManager.clearCookies();
Domain attribute is not required according to RFC, but it is important to remember that empty domain causes undefined behavior. So it is highly reccommended to specify it this this way:
final cookie = Cookie('cookieName', 'cookieValue')..domain = 'youtube.com';
If you see the error Strict Secure Cookie policy does not allow setting a secure cookie for http://your-domain.net/ for apps targeting >= R. Please either use the 'https:' scheme for this URL or omit the 'Secure' directive in the cookie value. Then you need to set the origin while setting the cookie, in that case setting the domain is not required.
final cookies = <Cookie>[];
// Add your cookie with secure flag to the array
cookieManager.setCookies(cookies, origin: 'https://your-domain.net')
target 'Runner' do
use_frameworks!
use_modular_headers!
..........
end